StackStorm / orquesta

Orquesta is a graph based workflow engine for StackStorm. Questions? https://github.com/StackStorm/st2/discussions
https://docs.stackstorm.com/orquesta/
Apache License 2.0
98 stars 39 forks source link

Fail Fast control for with item task #245

Open exp-vkishore opened 2 years ago

exp-vkishore commented 2 years ago

Currently the incomplete items in a task's with list won't be processed if there are no active task item and parent task has failed status. For example let's consider this workflow

version: 1.0

description: A workflow demonstrating with items and concurrent processing.

input:
  - members  # [0,1,2,3]
  - concurrency: 1

tasks:
  task1:
    with:
      items: <% ctx(members) %>
      concurrency: <% ctx(concurrency) %>
    action: core.local cmd="[ item() -eq  1 ] && exit 1 || exit 0"

If we run above workflow it will process items 0 and 1 only, as on member 1 action will fail which will set the task1 status as fail and the concurrency is set to 1 there for there will be no active task item and state of task1 will be set to failed from running. And no other item will be processed.

With this change I have introduce a boolean parameter failfast in task which will decide wether to fail the entire task if there are not active task item and task status is failed.

version: 1.0

description: A workflow demonstrating with items and concurrent processing.

input:
  - members  # [0,1,2,3]
  - concurrency: 1

tasks:
  task1:
    failfast: false
    with:
      items: <% ctx(members) %>
      concurrency: <% ctx(concurrency) %>
    action: core.local cmd="[ item() -eq  1 ] && exit 1 || exit 0"
cognifloyd commented 2 years ago

@exp-vkishore would you be able to revisit this? What do you think of @m4dcoder 's suggestion of a flow: keyword under with:?

CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.