Skip to content

Instantly share code, notes, and snippets.

@MichaelMcClure
Last active November 5, 2019 16:47
Show Gist options
  • Save MichaelMcClure/54a64fe6d61c4ecc0a2cff6621552889 to your computer and use it in GitHub Desktop.
Save MichaelMcClure/54a64fe6d61c4ecc0a2cff6621552889 to your computer and use it in GitHub Desktop.
Orquesta workflow fork/join example

Example of forking and joining workflows and task transistions.

---
version: '1.0'
input:
  - list1
  - a
vars:
  - p_task_1: unknown
output:
  - p_task_1: '{{ ctx().p_task_1 }}'
tasks:
  setup_task:
    action: core.noop
    # Run tasks in parallel
    next:
      - do: parallel_task_1, parallel_task_2

  parallel_task_1:
    with:
      items: item in <% ctx().list1 %>
    action: core.noop
    next:
      - when: "{{ succeeded() }}"
        publish: p_task_1="succeeded"
        do: barrier_task
      - when: "{{ failed() }}"
        publish: p_task_1="failed"
        do: barrier_task
      #- when: "{{ completed() }}"
      #  publish: p_task_1="completed"
      #  do: barrier_task

  parallel_task_2:
    action: core.noop
    with:
      items: item in <% ctx().list1 %>
    next:
      - do: barrier_task

  barrier_task:
    # there are 3 transitions to this task, but only two can possibly occur in an execution, hence "2" below
    join: 2
    action: core.noop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment