diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index 23602ffaef0f..4fe24cc528d7 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -1610,13 +1610,14 @@ def execute( else: input_value = step.state.inputs["input"] if input_value is None: - default_value = step.get_input_default_value(NO_REPLACEMENT) + default_value = step.get_input_default_value(None if step.input_optional else NO_REPLACEMENT) # TODO: look at parameter type and infer if value should be a dictionary # instead. Guessing only field parameter types in CWL branch would have # default as dictionary like this. if not isinstance(default_value, dict): default_value = {"value": default_value} - input_value = default_value.get("value", NO_REPLACEMENT) + input_value = default_value.get("value") + input_param = self.get_runtime_inputs(self)["input"] # TODO: raise DelayedWorkflowEvaluation if replacement not ready ? Need test try: diff --git a/lib/galaxy_test/workflow/optional_text_param_rescheduling.gxwf-tests.yml b/lib/galaxy_test/workflow/optional_text_param_rescheduling.gxwf-tests.yml new file mode 100644 index 000000000000..c531a2b803bb --- /dev/null +++ b/lib/galaxy_test/workflow/optional_text_param_rescheduling.gxwf-tests.yml @@ -0,0 +1,12 @@ +- doc: | + Test that scheduling succeeds even if step needs rescheduling + job: + optional_text: + type: raw + value: null + outputs: + out: + class: File + asserts: + - that: has_text + text: "null" diff --git a/lib/galaxy_test/workflow/optional_text_param_rescheduling.gxwf.yml b/lib/galaxy_test/workflow/optional_text_param_rescheduling.gxwf.yml new file mode 100644 index 000000000000..dbf5a4b57b64 --- /dev/null +++ b/lib/galaxy_test/workflow/optional_text_param_rescheduling.gxwf.yml @@ -0,0 +1,30 @@ +class: GalaxyWorkflow +inputs: + optional_text: + type: text + optional: true + when: + type: boolean + default: true +outputs: + out: + outputSource: gx_text_optional/inputs_json +steps: + pick_value: + tool_id: pick_value + tool_state: + style_cond: + pick_style: first + type_cond: + param_type: boolean + pick_from: + - value: true + gx_text_optional: + tool_id: gx_text_optional + # the when expression requires pick_value to execute, which recapitulates https://github.com/galaxyproject/galaxy/issues/19328 + when: $(inputs.when) + in: + parameter: + source: optional_text + when: + source: pick_value/boolean_param