-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Ability to set concurrency to max (equal to CPU cores) --concurrency=max
#761
Comments
In my opinion it would probably be even better if we could set the global default using an environment variable. I'm sure many people are like us: we have a long and complex CI pipeline with lots of jobs, adding It would be much simpler if we could specify e.g.
Note that simply changing turbo's default to the CPU count (like What do you think? |
I think these are separate features and both have the place. |
Closes #761 This is modeled after the way that `jest` [allows to set workers by providing a percent with `--maxWorkers=50%`](https://jestjs.io/docs/configuration#maxworkers-number--string). I've updated Turbo's CLI parsing to accept `--concurrency=50%`. It also supports percentages over 100%, so `--concurrency=500%` is valid. It uses `runtime.NumCPU()` to get the number of available logical processors, and calculates from there. Setting the percentage to zero or less is an error. Setting percentage very low, to eg `1%` results in always at least `1` as the value for concurrency.
Describe the feature you'd like to request
I am not an expert in this area, but I think it's counter-productive to set the concurrency to a higher number than there are CPU cores available for CPU-hungry processes, like tests and builds, as these processes would be competing for resources.
Thus, a default setting of 10 might be counter-productive in certain environments, like CI, where the number of cores can be lower.
For example, GitHub Actions only have 2 cores available for Windows and Linux, yet 3 for macOS.
Describe the solution you'd like
I think there should be a way to specify "max" or some other variation of that, that signals Turbo to sniff out the number of cores and set the concurrency to that value.
Describe alternatives you've considered
turbo run build --concurrency=$(node -r os -e 'process.stdout.write(os.cpus().length.toString())')
The text was updated successfully, but these errors were encountered: