-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Support a "default" option for build.jobs #11816
Comments
Some previous works:
I am okay with interpreting By the way, |
Is this still relevant? If yes, I’d like to give it a try. |
Thank you for asking! Personally, I am happy with the idea, but the team has yet discussed it. Once it is generally accepted you will see it labeled as
S-accepted
BTW, I'd also like to learn prior arts from other tools. How does |
Ack. |
I collected information from In all three, we observe the same logic, i.e. they require a positive integer argument. For reference,
|
I have a slight concern that 0 might be somewhat ambiguous. For example, ninja treats it as "infinity". Some other data:
Would there be any objections to using an english string to represent the "number of cpus" or some other meaning? Using 0 probably isn't so much of a leap from our use of negative numbers (and has some precedence), but a short string might be a little clearer. |
Second it. A simple English word is probably a clearer choice. This also enables some future extensions like simple math expressions (see #9221 (comment)). I propose the short word to be |
Let's put it this way. We could choose If we do have distributed build support in the future, I don't think we will need a breaking change. |
I also agree, having something like |
I'd like to accept this feature request. Let's do an FCP. @rfcbot FCP merge Currently there is no way to unset a config value, and this proposes using a simple English word to unset previously set Without this feature, it is impossible to unset For bike shedding the short word, we can decide later. The implementation side can start earlier once this feature is accepted. |
all CAPS doesn't work? @rfcbot fcp merge |
Team member @weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
I lean towards "default" 0 seems reasonable with us having -1 but that can be added later |
The Cargo team discussed this in the meeting today. We choose |
Still interested, thanks for the update! @rustbot claim |
Should this be implemented only on both CLI( |
Wooo! Glad to see this making progress, thanks @charmitro for putting up a PR! :) Side note: I opened this ticket originally with a different GitHub account, but have since merged everything into this one. To dissuade folks from tagging the old one, I renamed it, hence the 'do-not-use-parker-timmerman', sorry for any confusion! |
Thanks for the heads up, noted!
|
Problem
There is no way to "unset"/reset to "default, the number of build jobs specified to Cargo.
Consider your team has a
.cargo/config.toml
located in the root of your repository. You want to set the following:So that on all developer's machines, one core will be left available when running cargo for your computer to do other tasks.
But your CI infrastructure also runs
cargo
, and you want CI to use all possible cores to makes builds as fast as possible. You can set theCARGO_BUILD_JOBS
environment variable, but via the env variable (or--jobs
cli option) but there is no way to override the number of jobs back to "default"/num cpus.Proposed Solution
A solution is to define a new value that represents the default/num_cpus state. Two proposals would be:
0
jobs as meaning "default"a. Today specifying
0
as the number of jobs returns an error, so changing this shouldn't(?) break any flowsPersonally I'd prefer option 1 as it seems like the easiest, but I'm not sure if there are any flows that rely on
cargo
returning an error.Notes
No response
The text was updated successfully, but these errors were encountered: