Change default concurrency from 4 to available number of cpus
See original GitHub issueExpected Behavior
It would be nice if concurrency defaulted to os.cpus()
Current Behavior
Concurrency defaults to 4 no matter what.
Possible Solution
Change the DEFAULT_CONCURRENCY variable to be os.cpus()
.
Alternatively, enable this only with a flag to avoid a breaking change.
Context
This would allow jobs to scale easily with different instance sizes when running in things like EC2. I have some tasks that run sometimes in a 4 core machine and sometimes in a 16 core machine or even larger.
Most local machines have 4 cores anyway, so they would remain unchanged. But it’s hard to maximize concurrency using only the CLI right now.
"run-stuff": "lerna run task --concurrency 8"
If I have a package.json task like above, it’s hard to access the number of available CPUS to set the concurrency level. I need to instead run the lerna task from a node script, which is less convenient. Ideally, it would always maximize concurrency without needing to avoid the CLI. Or at least have that be available with a flag, like --maximize-concurrency
.
If this is something you’ll consider, I’m happy to do a PR to add it.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
My apologies! Setting
concurrency
inlerna.json
works.is concurrency still a valid option? it’s not listed in the docs:
https://github.com/lerna/lerna#lernajson