Skip to content

Commit

Permalink
Fix workflows with optional non-default parameter input
Browse files Browse the repository at this point in the history
where input not provided. Fixes #19328
  • Loading branch information
mvdbeek committed Dec 16, 2024
1 parent e921a29 commit 742054e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/galaxy/workflow/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1610,13 +1610,13 @@ 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_param = self.get_runtime_inputs(self)["input"]
# TODO: raise DelayedWorkflowEvaluation if replacement not ready ? Need test
try:
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
30 changes: 30 additions & 0 deletions lib/galaxy_test/workflow/optional_text_param_rescheduling.gxwf.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 742054e

Please sign in to comment.