Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix execution id propagation #57

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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