From 737423a89c4b5f666fb4daf61775764b66911cf1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 29 Mar 2009 18:00:45 +0000 Subject: * Use polling to wait for a remote build slot when using a build hook (that is, call the build hook with a certain interval until it accepts the build). * build-remote.pl was totally broken: for all system types other than the local system type, it would send all builds to the *first* machine of the appropriate type. --- src/libstore/build.cc | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 6c24a2746dd4..d80c67358b86 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -52,9 +52,6 @@ namespace nix { using std::map; -/* !!! TODO derivationFromPath shouldn't be used here */ - - static string pathNullDevice = "/dev/null"; @@ -229,9 +226,6 @@ public: /* Can we start another child process? */ bool canBuildMore(); - /* Can we postpone a build right now? */ - bool canPostpone(); - /* Registers a running child process. `inBuildSlot' means that the process counts towards the jobs limit. */ void childStarted(GoalPtr goal, pid_t pid, @@ -247,10 +241,6 @@ public: might be right away). */ void waitForBuildSlot(GoalPtr goal); - /* Put `goal' to sleep until a child process terminates, i.e., a - call is made to childTerminate(..., true). */ - void waitForChildTermination(GoalPtr goal); - /* Wait for any goal to finish. Pretty indiscriminate way to wait for some resource that some other goal is holding. */ void waitForAnyGoal(GoalPtr goal); @@ -1041,7 +1031,7 @@ void DerivationGoal::tryToBuild() return; case rpPostpone: /* Not now; wait until at least one child finishes. */ - worker.waitForChildTermination(shared_from_this()); + worker.waitForAWhile(shared_from_this()); outputLocks.unlock(); return; case rpDecline: @@ -1246,7 +1236,6 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook() thisSystem.c_str(), drv.platform.c_str(), drvPath.c_str(), - (worker.canPostpone() ? (string) "0" : "1").c_str(), (format("%1%") % maxSilentTime).str().c_str(), NULL); @@ -2243,8 +2232,6 @@ void SubstitutionGoal::tryToRun() logPipe.readSide.close(); - /* !!! close other handles */ - commonChildInit(logPipe); /* Fill in the arguments. */ @@ -2286,7 +2273,6 @@ void SubstitutionGoal::finished() /* Since we got an EOF on the logger pipe, the substitute is presumed to have terminated. */ - /* !!! this could block! */ pid_t savedPid = pid; int status = pid.wait(true); @@ -2469,12 +2455,6 @@ bool Worker::canBuildMore() } -bool Worker::canPostpone() -{ - return children.size() != 0; -} - - void Worker::childStarted(GoalPtr goal, pid_t pid, const set & fds, bool inBuildSlot) { @@ -2527,16 +2507,6 @@ void Worker::waitForBuildSlot(GoalPtr goal) } -void Worker::waitForChildTermination(GoalPtr goal) -{ - debug("wait for child termination"); - if (children.size() == 0) - throw Error("waiting for a build slot, yet there are no running children - " - "maybe the build hook gave an inappropriate `postpone' reply?"); - wantingToBuild.insert(goal); -} - - void Worker::waitForAnyGoal(GoalPtr goal) { debug("wait for any goal"); -- cgit 1.4.1