Skip to content

feat: allow specifying concurrency in config / environment #10236

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

Merged

Conversation

kade-robertson
Copy link
Contributor

@kade-robertson kade-robertson commented Mar 26, 2025

Description

This adds a couple new ways to configure task run concurrency:

  • A TURBO_CONCURRENCY environment variable
  • A concurrency configuration value in turbo.json

These options should follow the same precedence rules for other options which are made available in multiple locations. I think the environment variable is the most valuable to me (IMO), as this would make it a lot easier to turn off or drastically reduce concurrency in CI scenarios with restricted performance, where running multiple test suites at the same time could cause flaky results due to timeouts, or too much resource contention in general scenarios. Being able to specify this in the configuration file is maybe less valuable, but there are situations where it might be desirable.

The --concurrency option is obviously already available and certainly usable in combination with other changes (enforcing the use of an alias, or setting up different package.json scripts for CI and local development), but enabling this to be enforced via the config or an environment variable makes it a lot easier to turn off concurrency in CI, for example.

There is some active desire for this feature to exist:

Notably, this does not enable configuring concurrency per task, which was part of one of the discussions here. That seemed like a much larger lift vs. just adding an environment variable and config option that behaved exactly like the CLI argument already does. There is still some demand for this "simple" option.

Testing Instructions

  1. Build turbo
  2. Check that you can now specify a top-level "concurrency" property in your turbo.json, with the same behaviour as the CLI argument.
  3. Check that you can now specify a TURBO_CONCURRENCY environment variable, with the same behaviour as the CLI argument.
  4. Check that this settings maintains expected preference (i.e. CLI arg > env var > turbo.json)

I've done this checks (with some print debugging) on repos where I use turbo and it seems to work as expected. I've added some unit and integration tests where it seemed to make the most sense, but there were some spots where it was unclear if I should add something. If I've missed a spot or need some additional checks, let me know!

@kade-robertson kade-robertson requested review from anthonyshew and a team as code owners March 26, 2025 15:20
@turbo-orchestrator turbo-orchestrator bot added area: docs Improvements or additions to documentation needs: triage New issues get this label. Remove it after triage labels Mar 26, 2025
Copy link

vercel bot commented Mar 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 1:44pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 1:44pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 1:44pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 1:44pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 1:44pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 1:44pm

Copy link

vercel bot commented Mar 26, 2025

@kade-robertson is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@chris-olszewski chris-olszewski self-assigned this Mar 31, 2025
Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the contribution. Everything looks good aside from the removing of the inputs.execution_args reference in opts.

@chris-olszewski
Copy link
Member

If you could rebase, I'll work on getting this merged and released in the next canary. Thank you for the contribution!

@kade-robertson
Copy link
Contributor Author

If you could rebase, I'll work on getting this merged and released in the next canary. Thank you for the contribution!

Should be good to go!

@chris-olszewski chris-olszewski merged commit 248a41e into vercel:main Apr 14, 2025
46 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Improvements or additions to documentation needs: triage New issues get this label. Remove it after triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants