From 8a71739eddaad57e9577323f5c8d8342619a0e81 Mon Sep 17 00:00:00 2001 From: goFrendiAsgard Date: Tue, 28 Nov 2023 14:38:32 +0700 Subject: [PATCH 1/3] fix execution id propagation --- src/zrb/task/base_task.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/zrb/task/base_task.py b/src/zrb/task/base_task.py index ed204014..cff3bc58 100644 --- a/src/zrb/task/base_task.py +++ b/src/zrb/task/base_task.py @@ -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, @@ -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') @@ -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( From 848cfcf094968b9170ef5c79e683dfad3989b4bc Mon Sep 17 00:00:00 2001 From: goFrendiAsgard Date: Tue, 28 Nov 2023 14:39:15 +0700 Subject: [PATCH 2/3] update --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5eae7a8f..bffcd66b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" }, ] From e441286766068af9582900230905d340c6053394 Mon Sep 17 00:00:00 2001 From: goFrendiAsgard Date: Tue, 28 Nov 2023 14:41:47 +0700 Subject: [PATCH 3/3] remove variable --- src/zrb/task/base_task.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/zrb/task/base_task.py b/src/zrb/task/base_task.py index cff3bc58..12cbcbdf 100644 --- a/src/zrb/task/base_task.py +++ b/src/zrb/task/base_task.py @@ -313,10 +313,9 @@ async def _run_and_check_all( try: self._start_timer() if self.get_execution_id() == '': - execution_id = get_random_name( - add_random_digit=True, digit_count=5 + self._set_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)