CWL_CONDITIONALS_STATUS

CWL Conditional Workflow Support in Galaxy

CWL v1.2 Conditional Features

CWL v1.2 introduced three key conditional features:

  1. when — Step-level boolean expression; if false, step is skipped and outputs are null
  2. pickValue — Workflow output/step input directive for merging multiple sources:
    • first_non_null — return first non-null from source list
    • the_only_non_null — validate exactly one non-null, return it
    • all_non_null — return array of all non-null values
  3. MultipleInputFeatureRequirement — Required when outputSource or step input source is a list

What’s Implemented

Multiple input connections — WORKING

Galaxy already supports multiple connections to step inputs. 7 non-conditional multiple_input tests pass across v1.1/v1.2 (e.g. wf_multiplesources_multipletypes, wf_wc_scatter_multiple_merge, valuefrom_wf_step_multiple). The plumbing:

This confirms Galaxy’s workflow model handles multi-source connections — the gap is specifically in how workflow outputs (not inputs) reference multiple sources.

when expressions — WORKING

Galaxy has full support for step-level when expressions:

Parsing (CWL→Galaxy workflow):

Runtime evaluation:

Bug: SubworkflowStepProxy.to_dict() at parser.py:1137-1154 does NOT extract the when expression (only ToolStepProxy does). Conditional subworkflow steps lose their when condition during import.

What’s NOT Implemented

Multiple outputSource — NOT SUPPORTED

The crash point for all_non_null_all_null and all pickValue tests:

parser.py:607  get_outputs_for_label()
  → calls split_step_references(output["outputSource"], multiple=False, ...)
parser.py:982  split_step_references()
  → assert len(split_references) == 1  ← CRASH

get_outputs_for_label() hardcodes multiple=False, but the list outputSource pattern (e.g. outputSource: [step1/out1, step2/out1]) is exclusively a CWL v1.2 conditional feature — no non-conditional tests exercise this path. All the existing multiple_input tests that pass use multiple sources on step inputs, not workflow outputs.

pickValue — NOT IMPLEMENTED

No parsing, serialization, or runtime logic for pickValue exists anywhere in Galaxy source.

Test Status (v1.2 conditional tests)

GREEN (passing) — 13 tests

Simple when + single outputSource (no pickValue needed):

should_fail validation tests (pass because workflow import crashes on multiple outputSource):

RED (failing) — 27 tests

All tests requiring pickValue or multiple outputSource at the workflow output level:

pickValue: first_non_null (crash on multiple outputSource):

pickValue: the_only_non_null (crash on multiple outputSource):

pickValue: all_non_null (crash on multiple outputSource):

Scatter + conditional (various failures):

Complex conditional + defaults:

Architecture Gaps

To implement pickValue, Galaxy would need:

  1. Parser changes (parser.py):

    • get_outputs_for_label() must handle list outputSource (pass multiple=True)
    • Store pickValue directive on workflow output metadata
    • Multiple input connections already work, so the underlying model supports this
  2. Runtime changes (modules.py / run.py):

    • Apply pickValue semantics when collecting workflow outputs
    • Handle null-filtering (first_non_null, all_non_null) and validation (the_only_non_null)
  3. Scatter + conditional combination:

    • Some scatter tests produce null elements that need filtering
    • condifional_scatter_on_nonscattered_false expects out1: [] — all scatter elements skipped

Unresolved Questions