Skip to content

Commit 8b23139

Browse files
author
Alan Christie
committed
feat: Now realises outputs
1 parent c9131dc commit 8b23139

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

workflow/workflow_engine.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@
3838
WorkflowAPIAdapter,
3939
)
4040

41-
from .decoder import get_workflow_input_names_for_step, set_step_variables
41+
from .decoder import (
42+
get_workflow_input_names_for_step,
43+
get_workflow_output_values_for_step,
44+
set_step_variables,
45+
)
4246

4347
_LOGGER: logging.Logger = logging.getLogger(__name__)
4448
_LOGGER.setLevel(logging.INFO)
@@ -258,16 +262,24 @@ def _handle_pod_message(self, msg: PodMessage) -> None:
258262
#
259263
# We then inspect the Workflow to determine the next step.
260264

261-
# ToDo
265+
wfid = rwf_response["workflow"]["id"]
266+
assert wfid
267+
wf_response, _ = self._wapi_adapter.get_workflow(workflow_id=wfid)
268+
_LOGGER.debug("API.get_workflow(%s) returned: -\n%s", wfid, str(wf_response))
262269

270+
if output_values := get_workflow_output_values_for_step(wf_response, step_name):
271+
# Got some output values
272+
# Inform the DM so it can link them to the Project directory
273+
self._wapi_adapter.realise_outputs(
274+
running_workflow_step_id=r_wfsid,
275+
outputs=output_values,
276+
)
277+
278+
# Now we can mark this step as DONE...
263279
self._wapi_adapter.set_running_workflow_step_done(
264280
running_workflow_step_id=r_wfsid,
265281
success=True,
266282
)
267-
wfid = rwf_response["workflow"]["id"]
268-
assert wfid
269-
wf_response, _ = self._wapi_adapter.get_workflow(workflow_id=wfid)
270-
_LOGGER.debug("API.get_workflow(%s) returned: -\n%s", wfid, str(wf_response))
271283

272284
# We have the step from the Instance that's just finished,
273285
# so we can use that to find the next step in the Workflow definition.

0 commit comments

Comments
 (0)