pypyr.steps.call permalink

call another step in pipeline permalink

Call (invoke) another step-group in the same pipeline. Once the called group(s) are complete, pypyr continues processing from the point where you initiated the call.

If you want to jump to a different step-group and ignore the rest of the step-group you’re in, use pypyr.steps.jump instead.

input permalink

call expects a context item call. It can take one of two forms:

- name: pypyr.steps.call
  comment: simple string means just call the step-group named "callme"
  in:
    call: callme
- name: pypyr.steps.call
  comment: specify groups, success and failure.
  in:
    call:
      groups: ['callme', 'noreally'] # list. Step-groups to call.
      success: group_to_call_on_success # string. One step-group name.
      failure: group_to_call_on_failure # string. One step-group name.

call.groups can be a simple string if you’re just calling a single group - i.e you don’t need to make it a list of one item.

- name: pypyr.steps.call
  comment: specify single group
  in:
    call:
      groups: single_group # call a single group - no need for list.
      success: group_to_call_on_success # string. One step-group name.
      failure: group_to_call_on_failure # string. One step-group name.

call only runs success or failure groups if you actually specify these. You don’t have to specify success or failure groups - if you don’t, pypyr will just run the groups you explicitly specified and continue when done without trying to run any success or failure groups.

All inputs support string substitutions.

call inside a loop permalink

call can be handy when you use it in conjunction with looping step decorators like while or foreach:

steps:
  - name: pypyr.steps.echo
    in:
      echoMe: this is the 1st step of steps
  - name: pypyr.steps.call
    in:
      call: arbgroup
  - name: pypyr.steps.echo
    in:
     echoMe: You'll see me AFTER arbgroup is done.
  - name: pypyr.steps.call
    foreach: ['one', 'two', 'three']
    in:
      call: repeatme
arbgroup:
    - name: pypyr.steps.echo
      in:
        echoMe: this is arb group
    - pypyr.steps.stopstepgroup
    - name: pypyr.steps.echo
      in:
        echoMe: if you see me something is WRONG.
repeatme:
    - name: pypyr.steps.echo
      in:
        echoMe: this is iteration {i}

This will result in:

this is the 1st step of steps
this is arb group
You'll see me AFTER arbgroup is done.
this is iteration one
this is iteration two
this is iteration three

worked example permalink

See a worked example for call.

see also

last updated on .