[Feature] Log warning if yarn workstreams foreach
attempts to execute multiple jobs but that is not possible given the available resources and the --jobs
options in not set
#6669
Labels
enhancement
New feature or request
It seems to me that it would be ideal to have this in foreach.ts, but I'm 100% open to / encourage a discussion about the pros/cons of other approaches.
Describe the user story
As a developer, I would like to be able to execute
yarn dev
, whereyarn dev
is (example)yarn workspaces foreach -A --include backend --include app --parallel -v -i run start
with 2 or more workspaces that must run in parallelAND
I am running in a container (or other environment) where there are 2 or less CPU cores available
AND GIVEN
Source: https://yarnpkg.com/cli/workspaces/foreach
THEN
I would like a warning to be logged to stdout or stderr informing me that it is impossible for the number of parallel tasks I've tried to start in my
yarn dev
to be executed given the CPU cores available in this environmentDescribe the solution you'd like
Given the user story above, I would like a warning to be logged to stdout or stderr informing me that it is impossible for the number of parallel tasks I've tried to start in my
yarn dev
to be executed given the CPU cores available in this environment.In foreach.ts and before we execute pLimit, could we check the available parallelism using
os
'savailableParallelism()
and determine if we have the number of CPU cores available we would need to execute the number of parallel tasks that have been dictated in theyarn workspaces foreach
command?If, for any reason, we cannot confidently determine the number of available CPU cores via
availableParallelism()
, we could use a conditional and not log a warning / maintain the exact same behavior the command has today.Describe the drawbacks of your solution
I am not aware of drawbacks, but I am hoping we can discuss those in this issue.
Describe alternatives you've considered
I have not explored turning this into a plugin do to the nature of 'where' this code would have to be executed within the
foreach
command's execution. I am, however, open to any ideas anyone may have to solve this in a different way.The text was updated successfully, but these errors were encountered: