From 6b3d13e4270a773835e8662dd4e42fc23a56367c Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 14 Nov 2020 23:15:40 +0100 Subject: [PATCH] Recover step output value in WorkflowProgress instance. Fixes running subworkflows with parameter_input steps. Fixes https://github.com/galaxyproject/galaxy/issues/8390 and allows us to get rid of one FIXME I added when working around https://github.com/galaxyproject/galaxy/issues/8248. --- lib/galaxy/model/mapping.py | 8 ++++++++ lib/galaxy/workflow/run.py | 16 ++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/galaxy/model/mapping.py b/lib/galaxy/model/mapping.py index 38622dc1f3b..48ae5cf0ebf 100644 --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -2625,6 +2625,14 @@ simple_mapping( simple_mapping( model.WorkflowInvocationOutputValue, workflow_invocation=relation(model.WorkflowInvocation, backref="output_values"), + workflow_invocation_step=relation(model.WorkflowInvocationStep, + foreign_keys=[model.WorkflowInvocationStep.table.c.workflow_invocation_id, model.WorkflowInvocationStep.table.c.workflow_step_id], + primaryjoin=and_( + model.WorkflowInvocationStep.table.c.workflow_invocation_id == model.WorkflowInvocationOutputValue.table.c.workflow_invocation_id, + model.WorkflowInvocationStep.table.c.workflow_step_id == model.WorkflowInvocationOutputValue.table.c.workflow_step_id, + ), + backref='output_value' + ), workflow_step=relation(model.WorkflowStep), workflow_output=relation(model.WorkflowOutput), ) diff --git a/lib/galaxy/workflow/run.py b/lib/galaxy/workflow/run.py index 35938c3ca36..b4bdeda6187 100644 --- a/lib/galaxy/workflow/run.py +++ b/lib/galaxy/workflow/run.py @@ -352,16 +352,10 @@ class WorkflowProgress: try: replacement = step_outputs[output_name] except KeyError: - replacement = self.inputs_by_step_id.get(output_step_id) - if connection.output_step.type == 'parameter_input' and output_step_id is not None: - # FIXME: parameter_input step outputs should be properly recorded as step outputs, but for now we can - # short-circuit and just pick the input value - pass - else: - # Must resolve. - template = "Workflow evaluation problem - failed to find output_name %s in step_outputs %s" - message = template % (output_name, step_outputs) - raise Exception(message) + # Must resolve. + template = "Workflow evaluation problem - failed to find output_name %s in step_outputs %s" + message = template % (output_name, step_outputs) + raise Exception(message) if isinstance(replacement, model.HistoryDatasetCollectionAssociation): if not replacement.collection.populated: if not replacement.waiting_for_elements: @@ -428,6 +422,8 @@ class WorkflowProgress: def set_step_outputs(self, invocation_step, outputs, already_persisted=False): step = invocation_step.workflow_step + if invocation_step.output_value: + outputs[invocation_step.output_value.workflow_output.output_name] = invocation_step.output_value.value self.outputs[step.id] = outputs if not already_persisted: for output_name, output_object in outputs.items():