Hydra ETL
Build your first job
Hydra DSL7 · Expressionsstep.when
Grammar element · workflow.steps.when

step.when gates one workflow node

Three safe boolean guards. A true guard runs the node; a false guard skips it and its dependants.

workflow.yaml4 steps

      
What the runner decides

Whether one ready node may execute after its dependencies have completed.

✓ guard true · step runs

What workflow.steps.when is

step.when is a safe boolean guard evaluated after dependencies are complete and before one workflow node runs.

It is not Python eval. Hydra parses an allow-listed AST of comparisons, boolean operators, literals, lists, tuples, and parameter/environment placeholders.

What it contains

  • Comparisons — Equality and ordered comparisons, with numeric coercion when appropriate.
  • Boolean logicand, or, and not.
  • Safe values — Literals plus {{ param:NAME }} and {{ env:NAME }} placeholders.

Ready does not always mean run

Dependencies decide when a node is ready. when makes the final admission decision for that node without changing the topology of the graph.

When gates a ready workflow step After dependencies complete, a true when expression admits the step to execution. dependencies donenode ready when: truesafe guard step runsnode admitted A false guard records a skip instead of running the node.
Dependency readiness and conditional admission are separate decisions.

Run the complete example

Copy this manifest from the verified documentation project, then run it from the repository root.

workflow:
  version: "1.0"
  name: docs_workflow
  description: Two actions used by the DSL documentation.
  trigger: {type: manual}
  steps:
    - name: prepare
      type: action
      action: log
      params: {message: "Preparation complete."}
      retry: {max: 2, delay: 0, backoff: fixed}
    - name: publish
      type: action
      action: log
      params: {message: "Publication complete."}
      depends_on: [prepare]
      when: "1 == 1"
      on_failure: fail
hdrctl workflow run examples/tutorial/dsl-elements/workflow.yaml
  ✓  Step 'prepare' OK (0.0s)
  ✓  Step 'publish' OK (0.0s)

  ✅ Workflow 'docs_workflow' completed in 0.0s — 2/2 steps OK

The relevant command syntax, copied from hdrctl workflow run --help:

hdrctl workflow run PATH
  PATH          path to workflow.yaml
  --lang LANG   interface language
  -h, --help    show command help

Close by

0 / 0 on this page