skip permalink

selectively skip step permalink

Skip this step if True, run step if False. Evaluates after the run decorator. This means that if run is False, the step will never run, regardless of skip.

Default is False. This means by default pypyr will not skip a step.

If this looks like it’s merely the inverse of run, that’s because it is. Use whichever suits your pipeline better, or combine run and skip in the same pipeline to toggle at runtime which steps you want to execute. You can also combine run and skip in the same step.

You’ll almost always use skip with substitutions, so you set the value at run-time from context.

set skip with substitution expressions permalink

You can use truthy expressions with run, skip and swallow. This means you can selectively skip a step depending on if an object is not null and evaluates truthy.

# ./skip-decorator.yaml
  - name: pypyr.steps.echo
    comment: skip is False by default
      echoMe: begin
  - name: pypyr.steps.echo
    skip: True
      echoMe: this won't run coz skipping the step.
  - name: pypyr.steps.echo
    skip: 1
      echoMe: 1 in a boolean context means True.
  - name: pypyr.steps.contextsetf
    comment: set some arb values to use in 
             next steps.
        isAnotherThing: 0 # int 0 evals False.
        isThing: False
        arbObj: ["one", "two", "three"] # list
  - name: pypyr.steps.echo
    skip: '{arbObj}'
      echoMe: you won't see me because truthy list is True.
  - name: pypyr.steps.echo
    skip: '{isAnotherThing}'
      echoMe: you'll see me.
  - name: pypyr.steps.echo
      echoMe: end

This pipeline will run like this:

pypyr skip-decorator
you'll see me.

see also

last updated on .