about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-12-04T14·29+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-12-04T14·29+0000
commit909fbb9de1e3e2d020a3dd000b9009a5ff1aaeca (patch)
tree9e26c4fc9b830afa11e5ffc6746ff8f30332392d /scripts
parent5dfba0b4db24f4943c5b529eb3b092a64bcd6b18 (diff)
* When using build hooks, for any nix-store -r build operation, it is
  necessary that at least one build hook doesn't return "postpone",
  otherwise nix-store will barf ("waiting for a build slot, yet there
  are no running children").  So inform the build hook when this is
  the case, so that it can start a build even when that would exceed
  the maximum load on a machine.

Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-remote.pl.in12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index a7023cb4dff3..33b943602315 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -23,10 +23,8 @@ use English '-no_match_vars';
 
 my $loadIncreased = 0;
 
-my $amWilling = shift @ARGV;
-my $localSystem = shift @ARGV;
-my $neededSystem = shift @ARGV;
-my $drvPath = shift @ARGV;
+my ($amWilling, $localSystem, $neededSystem, $drvPath, $mustRun) = @ARGV;
+$mustRun = 0 unless defined $mustRun;
 
 sub sendReply {
     my $reply = shift;
@@ -91,13 +89,15 @@ LOOP: foreach my $cur (@machines) {
         # We have a machine of the right type.  Try to get a lock on
         # one of the machine's lock files.
         my $slot = 0;
-        while ($slot < $cur->{maxJobs}) {
+        while ($slot < $cur->{maxJobs} || $mustRun) {
             my $slotLock = "$currentLoad/" . $cur->{systemType} . "-" . $cur->{hostName} . "-$slot";
             open SLOTLOCK, ">>$slotLock" or die;
             if (flock(SLOTLOCK, LOCK_EX | LOCK_NB)) {
+                print STDERR "warning: exceeding maximum load on " . $cur->{systemType} . "\n"
+                    if $slot >= $cur->{maxJobs};
                 $machine = $cur;
                 last LOOP;
-            }                
+            }
             close SLOTLOCK;
             $slot++;
         }