Don't let 'preferLocalBuild' override 'max-jobs=0'#4443
Merged
edolstra merged 2 commits intoNixOS:masterfrom Jan 13, 2021
Merged
Don't let 'preferLocalBuild' override 'max-jobs=0'#4443edolstra merged 2 commits intoNixOS:masterfrom
edolstra merged 2 commits intoNixOS:masterfrom
Conversation
This resolves NixOS#3810 by changing the behavior of `max-jobs = 0`, so that specifying the option also avoids local building of derivations with the attribute `preferLocalBuild = true`.
This was referenced Jan 12, 2021
Member
|
Can you also update this code in /* Make sure that we are allowed to start a build. If this
derivation prefers to be done locally, do it even if
maxBuildJobs is 0. */
unsigned int curBuilds = worker.getNrLocalBuilds();
if (curBuilds >= settings.maxBuildJobs && !(buildLocally && curBuilds == 0)) {
worker.waitForBuildSlot(shared_from_this());
outputLocks.unlock();
return;
} |
Member
Author
|
@edolstra Is there anything else than the comment that actually needs to be changed in that code? My commit changes the behavior of |
Member
|
Probably the comment needs changing too. |
Member
|
The condition |
Member
Author
|
@edolstra Thanks, I've removed it now. |
Member
|
Thanks! |
Ericson2314
reviewed
Feb 17, 2026
| return false; | ||
|
|
||
| if (settings.maxBuildJobs.get() == 0 | ||
| && !drv.isBuiltin()) |
Member
There was a problem hiding this comment.
Why do we have this isn't builtin check here? do derivations running builtin builders not count towards max jobs?! I wouldn't think so
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This resolves #3810 by changing the behavior of
max-jobs = 0, sothat specifying the option also avoids local building of derivations
with the attribute
preferLocalBuild = true.A more complicated resolution was suggested by @grahamc in #3810, that also made it possible to retain the original behavior of
max-jobs=0. However, it has been suggested (here and here) that just lettingpreferLocalbuildrespectmax-jobs=0is an acceptable solution too.