Skip to content

feat: add failfast support for parallel tasks #2307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

elvism-lullabot
Copy link

@elvism-lullabot elvism-lullabot commented Jun 24, 2025

Implement new failfast behavior to terminate the parent task immediately when any child task fails.

This replaces the previous default behavior, where he execution will stop as soon as any task fails.

New default behavior

By default, when running tasks, the execution of child tasks continues even if one fails.

Restoring Previous Behavior

To restore the previous behavior, you can explicitly set failfast: true or with the flag --failfast.

Example

With this configuration, if task-a fails early, the parent will stop immediately without waiting for task-b or task-c.

version: '3'

tasks:
  task-a:
    cmds: [ "bash -c 'echo A; sleep 1; exit 1'" ]
  task-b:
    cmds: [ "bash -c 'echo B; sleep 2; exit 0'" ]
  task-c:
    cmds: [ "bash -c 'echo C; sleep 3; exit 1'" ]

  parent:
    deps: [task-a, task-b, task-c]
    failfast: true  # To restore the previous behavior

@deviantintegral
Copy link
Contributor

Looking forward to seeing how tests go here!

@elvism-lullabot is this defining "fail fast" backwards? To me, failfast: true matches the current behaviour of task. If we set it to false, it would mean we'd "fail slow" and let existing tasks run to completion.

@elvism-lullabot
Copy link
Author

Looking forward to seeing how tests go here!

@elvism-lullabot is this defining "fail fast" backwards? To me, failfast: true matches the current behaviour of task. If we set it to false, it would mean we'd "fail slow" and let existing tasks run to completion.

I updated the code so that the failfast behavior matches the PR description and desired logic.

@anthony-hayes
Copy link

anthony-hayes commented Jul 14, 2025

Really excited for this. I'm not a maintainer, but I wonder if it would make sense to make failFast default to true, to preserve the existing behaviour, so this could be shipped quicker (wouldn't be a breaking change)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants