aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/drv-output-substitution-goal.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-08-11 01:37:40 +0200
committereldritch horrors <pennae@lix.systems>2024-08-18 09:10:05 +0000
commit38f550708dd01515f7aaf66b0cc548fcd701e1c0 (patch)
tree67150416d442821b921d705aa5401a87c1d8f3bb /src/libstore/build/drv-output-substitution-goal.cc
parent176e1058f11d4b957a82bd6cc184e73b1ce5688f (diff)
libstore: add explicit in-build-slot-ness to goals
we don't need to expose information about how busy a Worker is if the worker can instead tell its work items whether they are in a slot. in the future we might use this to not start items waiting for a slot if no slots are currently available, but that requires more preparation. Change-Id: Ibe01ac536da7e6d6f80520164117c43e772f9bd9
Diffstat (limited to 'src/libstore/build/drv-output-substitution-goal.cc')
-rw-r--r--src/libstore/build/drv-output-substitution-goal.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/libstore/build/drv-output-substitution-goal.cc b/src/libstore/build/drv-output-substitution-goal.cc
index b41dae5d6..087673be7 100644
--- a/src/libstore/build/drv-output-substitution-goal.cc
+++ b/src/libstore/build/drv-output-substitution-goal.cc
@@ -20,7 +20,7 @@ DrvOutputSubstitutionGoal::DrvOutputSubstitutionGoal(
}
-Goal::WorkResult DrvOutputSubstitutionGoal::init()
+Goal::WorkResult DrvOutputSubstitutionGoal::init(bool inBuildSlot)
{
trace("init");
@@ -30,17 +30,14 @@ Goal::WorkResult DrvOutputSubstitutionGoal::init()
}
subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
- return tryNext();
+ return tryNext(inBuildSlot);
}
-Goal::WorkResult DrvOutputSubstitutionGoal::tryNext()
+Goal::WorkResult DrvOutputSubstitutionGoal::tryNext(bool inBuildSlot)
{
trace("trying next substituter");
- /* Make sure that we are allowed to start a substitution. Note that even
- if maxSubstitutionJobs == 0, we still allow a substituter to run. This
- prevents infinite waiting. */
- if (worker.runningSubstitutions >= std::max(1U, settings.maxSubstitutionJobs.get())) {
+ if (!inBuildSlot) {
return WaitForSlot{};
}
@@ -84,7 +81,7 @@ Goal::WorkResult DrvOutputSubstitutionGoal::tryNext()
return StillAlive{};
}
-Goal::WorkResult DrvOutputSubstitutionGoal::realisationFetched()
+Goal::WorkResult DrvOutputSubstitutionGoal::realisationFetched(bool inBuildSlot)
{
worker.childTerminated(this);
maintainRunningSubstitutions.reset();
@@ -97,7 +94,7 @@ Goal::WorkResult DrvOutputSubstitutionGoal::realisationFetched()
}
if (!outputInfo) {
- return tryNext();
+ return tryNext(inBuildSlot);
}
WaitForGoals result;
@@ -114,7 +111,7 @@ Goal::WorkResult DrvOutputSubstitutionGoal::realisationFetched()
worker.store.printStorePath(localOutputInfo->outPath),
worker.store.printStorePath(depPath)
);
- return tryNext();
+ return tryNext(inBuildSlot);
}
result.goals.insert(worker.makeDrvOutputSubstitutionGoal(depId));
}
@@ -123,14 +120,14 @@ Goal::WorkResult DrvOutputSubstitutionGoal::realisationFetched()
result.goals.insert(worker.makePathSubstitutionGoal(outputInfo->outPath));
if (result.goals.empty()) {
- return outPathValid();
+ return outPathValid(inBuildSlot);
} else {
state = &DrvOutputSubstitutionGoal::outPathValid;
return result;
}
}
-Goal::WorkResult DrvOutputSubstitutionGoal::outPathValid()
+Goal::WorkResult DrvOutputSubstitutionGoal::outPathValid(bool inBuildSlot)
{
assert(outputInfo);
trace("output path substituted");
@@ -159,9 +156,9 @@ std::string DrvOutputSubstitutionGoal::key()
return "a$" + std::string(id.to_string());
}
-Goal::WorkResult DrvOutputSubstitutionGoal::work()
+Goal::WorkResult DrvOutputSubstitutionGoal::work(bool inBuildSlot)
{
- return (this->*state)();
+ return (this->*state)(inBuildSlot);
}