mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
* 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.
This commit is contained in:
parent
47706e3924
commit
737423a89c
2 changed files with 3 additions and 36 deletions
|
@ -23,8 +23,7 @@ use English '-no_match_vars';
|
|||
|
||||
my $loadIncreased = 0;
|
||||
|
||||
my ($amWilling, $localSystem, $neededSystem, $drvPath, $mustRun, $maxSilentTime) = @ARGV;
|
||||
$mustRun = 0 unless defined $mustRun;
|
||||
my ($amWilling, $localSystem, $neededSystem, $drvPath, $maxSilentTime) = @ARGV;
|
||||
$maxSilentTime = 0 unless defined $maxSilentTime;
|
||||
|
||||
sub sendReply {
|
||||
|
@ -87,12 +86,10 @@ 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 && !$canBuildLocally)) {
|
||||
while ($slot < $cur->{maxJobs}) {
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue