Skip to content
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

new: Add moon run --eager to disable fail-fast behavior and execute as many tasks as possible #1773

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

chadrik
Copy link
Contributor

@chadrik chadrik commented Jan 1, 2025

The --eager flag makes moon run behave more like moon ci.

Fixes #1770

@chadrik
Copy link
Contributor Author

chadrik commented Jan 1, 2025

I confirmed that providing --eager fixes the issue with --summary not displaying when a task fails, but it returns 0 if there are task failures, which is not the desired behavior.

@milesj
Copy link
Collaborator

milesj commented Jan 1, 2025

Could you point this to the develop-1.31 branch.

@chadrik
Copy link
Contributor Author

chadrik commented Jan 1, 2025

I did a quick eval of a few other task runners to see if they have a similar option. Here's the result:

Tool Flag Docs
just N/A (note: as far as I can tell just runs tasks serially)
task N/A
turbo --continue Continue with task execution in the presence of an error (e.g. non-zero exit code from a task). When --continue is true, turbo will exit with the highest exit code value encountered during execution. Specifying the --parallel flag will automatically set --continue to true unless explicitly set to false.
pre-commit fail_fast set to true to have pre-commit stop running hooks after the first failure. (note: pre-commit runs tasks serially)
nx --nxBail Stop command execution after the first failed task.

It's unclear if turbo run --continue skips tasks with upstream failures like moon does, but it could be a good name for this feature.

@chadrik chadrik changed the base branch from master to develop-1.31 January 1, 2025 19:38
@chadrik
Copy link
Contributor Author

chadrik commented Jan 1, 2025

Note that all of the tools I've canvased so far default to eager/aggressive behavior, with a flag to manually enable the fail-fast mode. As stated, turborepo defaults to --continue when in --parallel mode.

@milesj
Copy link
Collaborator

milesj commented Jan 1, 2025

Note that all of the tools I've canvased so far default to eager/aggressive behavior, with a flag to manually enable the fail-fast mode. As stated, turborepo defaults to --continue when in --parallel mode.

Yeah I noticed this also. Would be a breaking change for moon, but something I can look into changing for 2.0.

@chadrik
Copy link
Contributor Author

chadrik commented Jan 2, 2025

I added the fix for exiting non-zero on failure.

As for names, I prefer --eager because I feel that --continue could imply that even tasks with upstream failures will be run, but it is compelling that both Turborepo and Lage use --continue. The decision is yours.

I'm leaning towards --continue myself (simple 1 word) but I also like the idea of supporting an enum.
--on-failure bail (default), --on-failure continue, --on-failure 10 (bail after 10 errors)

I don't find the "bail after 10 errors" mode very useful, but I could see a trio of options like this being useful:

--abort-on-failure: immediate (default), delayed (process safe tasks), disabled (even tasks with upstream failures)

The final mode is not supported right now, but using an enum would keep the option open. Or just deal with it in 2.0.

The simplest solution is probably -c --continue. Let me know and I'll make the adjustment.

@milesj
Copy link
Collaborator

milesj commented Jan 3, 2025

My only hesitation with --eager is that it reminds me of eager vs lazy loading, so I immediately think of "run all the things" instead of "keep running things".

Maybe --no-bail to keep it simple? I can revisit the enum pattern in v2.

@chadrik
Copy link
Contributor Author

chadrik commented Jan 3, 2025

Sounds good. Should it be --no-bail or --noBail?

The --no-bail flag makes moon run behave more like moon ci.
@chadrik
Copy link
Contributor Author

chadrik commented Jan 3, 2025

I pushed up the changes with --no-bail

@milesj
Copy link
Collaborator

milesj commented Jan 3, 2025

Awesome stuff, thanks!

Aiming to release 1.31 on monday.

@milesj milesj merged commit b5416b5 into moonrepo:develop-1.31 Jan 3, 2025
milesj pushed a commit that referenced this pull request Jan 6, 2025
… as many tasks as possible (#1773)

new: Add `moon run --no-bail` to disable fail-fast behavior

The --no-bail flag makes moon run behave more like moon ci.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Provide an option to disable fail-fast behavior and process as much of the task graph as possible
2 participants