Fix running subworkflows with disconnected optional/default inputs

This commit is contained in:
mvdbeek
2022-09-21 19:31:41 +02:00
parent 58142b8f44
commit 64cb245ddd
3 changed files with 9 additions and 3 deletions
+4
View File
@@ -7050,6 +7050,10 @@ class WorkflowStep(Base, RepresentById):
self.uuid = uuid4()
self._input_connections_by_name = None
@reconstructor
def init_on_load(self):
self._input_connections_by_name = None
@property
def tool_uuid(self):
return self.dynamic_tool and self.dynamic_tool.uuid
+3 -3
View File
@@ -466,9 +466,9 @@ class WorkflowProgress:
subworkflow_inputs = {}
for input_subworkflow_step in subworkflow.input_steps:
connection_found = False
subworkflow_step_id = input_subworkflow_step.id
for input_connection in step.input_connections:
if input_connection.input_subworkflow_step == input_subworkflow_step:
subworkflow_step_id = input_subworkflow_step.id
if input_connection.input_subworkflow_step_id == subworkflow_step_id:
is_data = input_connection.output_step.type != "parameter_input"
replacement = self.replacement_for_connection(
input_connection,
@@ -478,7 +478,7 @@ class WorkflowProgress:
connection_found = True
break
if not connection_found:
if not connection_found and not input_subworkflow_step.input_optional:
raise Exception("Could not find connections for all subworkflow inputs.")
return WorkflowProgress(subworkflow_invocation, subworkflow_inputs, self.module_injector, param_map=param_map)
@@ -189,6 +189,8 @@ class WorkflowProgressTestCase(unittest.TestCase):
subworkflow_invocation = self.invocation.create_subworkflow_invocation_for_step(
self.invocation.workflow.step_by_index(1)
)
self.app.model.session.add(subworkflow_invocation)
self.app.model.session.flush()
progress = self._new_workflow_progress()
remaining_steps = progress.remaining_steps()
(subworkflow_step, subworkflow_invocation_step) = remaining_steps[0]