diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-12-04T16·35+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-12-04T16·35+0000 |
commit | bcfe98acffbefea734f51523b386868ae443c111 (patch) | |
tree | 78b73718e78d604eb00ec0a8e907a2db71b4324a | |
parent | 9850262a72d1eb77c8f36cf44a9a4aaffedc5d6b (diff) |
* Prefer building on a remote machine over a local machine. This
makes more sense for the build farm, otherwise every nix-store invocation will lead to at least one local build. Will come up with a better solution later...
-rwxr-xr-x | scripts/build-remote.pl.in | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in index 33b943602315..fe2fbaf899e6 100755 --- a/scripts/build-remote.pl.in +++ b/scripts/build-remote.pl.in @@ -45,8 +45,7 @@ mkdir $currentLoad, 0777 or die unless -d $currentLoad; my $conf = $ENV{"NIX_REMOTE_SYSTEMS"}; decline if !defined $conf || ! -e $conf; -# Decline if the local system can do the build. -decline if $amWilling && ($localSystem eq $neededSystem); +my $canBuildLocally = $amWilling && ($localSystem eq $neededSystem); # Otherwise find a willing remote machine. @@ -89,7 +88,7 @@ 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} || $mustRun) { + while ($slot < $cur->{maxJobs} || ($mustRun && !$canBuildLocally)) { my $slotLock = "$currentLoad/" . $cur->{systemType} . "-" . $cur->{hostName} . "-$slot"; open SLOTLOCK, ">>$slotLock" or die; if (flock(SLOTLOCK, LOCK_EX | LOCK_NB)) { @@ -107,9 +106,11 @@ LOOP: foreach my $cur (@machines) { close MAINLOCK; -# Didn't find one? +# Didn't find one? Then decline or postpone. if (!defined $machine) { - if ($rightType) { + # Postpone if we have a machine of the right type, except if the + # local system can and wants to do the build. + if ($rightType && !$canBuildLocally) { sendReply "postpone"; exit 0; } else { |