Skip to content

Commit

Permalink
fix execution id propagation (#57)
Browse files Browse the repository at this point in the history
* fix execution id propagation

* update

* remove variable
  • Loading branch information
goFrendiAsgard authored Nov 28, 2023
1 parent bf33eb1 commit 9871b78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "zrb"
version = "0.0.116"
version = "0.0.117"
authors = [
{ name="Go Frendi Gunawan", email="gofrendiasgard@gmail.com" },
]
Expand Down
12 changes: 11 additions & 1 deletion src/zrb/task/base_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,15 @@ def _get_normalized_input_key(self, key: str) -> str:
return key
return to_variable_name(key)

def _propagate_execution_id(self):
execution_id = self.get_execution_id()
for upstream_task in self._get_upstreams():
upstream_task._set_execution_id(execution_id)
upstream_task._propagate_execution_id()
for checker_task in self._get_checkers():
checker_task._set_execution_id(execution_id)
checker_task._propagate_execution_id()

async def _run_and_check_all(
self,
env_prefix: str,
Expand All @@ -307,6 +316,7 @@ async def _run_and_check_all(
self._set_execution_id(
get_random_name(add_random_digit=True, digit_count=5)
)
self._propagate_execution_id()
self.log_info('Set input and env map')
await self._set_keyval(kwargs=kwargs, env_prefix=env_prefix)
self.log_info('Set run kwargs')
Expand Down Expand Up @@ -533,7 +543,7 @@ async def _set_keyval(self, kwargs: Mapping[str, Any], env_prefix: str):
# set checker keyval
# local_env_map = self.get_env_map()
checker_coroutines = []
for checker_task in self._checkers:
for checker_task in self._get_checkers():
checker_task.add_input(*self._get_inputs())
checker_task.add_env(*self._get_envs())
checker_coroutines.append(asyncio.create_task(
Expand Down

0 comments on commit 9871b78

Please sign in to comment.