Skip to content

Commit

Permalink
fix execution id propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
goFrendiAsgard committed Nov 28, 2023
1 parent bf33eb1 commit 8a71739
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions 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 @@ -304,9 +313,11 @@ async def _run_and_check_all(
try:
self._start_timer()
if self.get_execution_id() == '':
self._set_execution_id(
get_random_name(add_random_digit=True, digit_count=5)
execution_id = get_random_name(
add_random_digit=True, digit_count=5
)
self._set_execution_id(execution_id)
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 +544,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 8a71739

Please sign in to comment.