Skip to content

Commit b788cd0

Browse files
author
Alan Christie
committed
fix: Fix prior-step prefix
1 parent ac23732 commit b788cd0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

workflow/workflow_engine.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def __init__(
136136
wapi_adapter: WorkflowAPIAdapter,
137137
instance_launcher: InstanceLauncher,
138138
instance_link_glob: str = ".instance-*",
139+
instance_id_dir_prefix: str = ".",
139140
):
140141
"""Initialiser, given a Workflow API adapter, Instance launcher,
141142
and a step (directory) link 'glob' (a convenient directory glob to
@@ -145,6 +146,7 @@ def __init__(
145146
self._wapi_adapter: WorkflowAPIAdapter = wapi_adapter
146147
self._instance_launcher: InstanceLauncher = instance_launcher
147148
self._instance_link_glob: str = instance_link_glob
149+
self._instance_id_dir_prefix: str = instance_id_dir_prefix
148150

149151
self._predefined_variables: dict[str, Any] = {
150152
"instance-link-glob": instance_link_glob
@@ -619,8 +621,14 @@ def _prepare_step(
619621
running_workflow_id=rwf_id,
620622
)
621623
assert prior_step
622-
assert "instance_directory" in prior_step
623-
p_instance_dir: str = prior_step["instance_directory"]
624+
_LOGGER.info(
625+
"API.get_running_workflow_step_by_name(%s) got %s\n",
626+
prior_step_name,
627+
str(prior_step),
628+
)
629+
assert "instance_id" in prior_step
630+
p_i_id: str = prior_step["instance_id"]
631+
p_i_dir: str = f"{self._instance_id_dir_prefix}{p_i_id}"
624632
# Get prior step Job (tro look for inputs)
625633
# (if we're not a combiner)
626634
p_job_inputs: dict[str, Any] = {}
@@ -644,8 +652,8 @@ def _prepare_step(
644652
assert connector.in_ in prior_step["variables"]
645653
value: str = prior_step["variables"][connector.in_]
646654
if not we_are_a_combiner and connector.in_ in p_job_inputs:
647-
# Prefix with prior-step instance directory
648-
value = f"{p_instance_dir}/{value}"
655+
# Prefix with prior-step's instance directory
656+
value = f"{p_i_dir}/{value}"
649657
prime_variables[connector.out] = value
650658

651659
# Our step's prime variables are now set.

0 commit comments

Comments
 (0)