diff options
-rwxr-xr-x | distributed/build-remote.pl | 36 | ||||
-rw-r--r-- | distributed/remote-systems.conf | 2 | ||||
-rwxr-xr-x | distributed/test.sh | 5 | ||||
-rw-r--r-- | src/libstore/normalise.cc | 2 |
4 files changed, 34 insertions, 11 deletions
diff --git a/distributed/build-remote.pl b/distributed/build-remote.pl index f1a9b10f4..12cb272b9 100755 --- a/distributed/build-remote.pl +++ b/distributed/build-remote.pl @@ -7,9 +7,16 @@ my $localSystem = shift @ARGV; my $neededSystem = shift @ARGV; my $storeExpr = shift @ARGV; +sub sendReply { + my $reply = shift; + open OUT, ">&3" or die; + print OUT "$reply\n"; + close OUT; +} + # Decline if the local system can do the build. if ($amWilling && ($localSystem eq $neededSystem)) { - print "decline\n"; + sendReply "decline"; exit 0; } @@ -45,11 +52,8 @@ while (<LOAD>) { } close LOAD; -sub sendReply { - my $reply = shift; - open OUT, ">&3" or die; - print OUT "$reply\n"; - close OUT; +foreach my $cur (keys %machines) { + $curJobs{$cur} = 0 unless defined $curJobs{$cur}; } # Find a suitable system. @@ -58,8 +62,7 @@ my $machine; foreach my $cur (keys %machines) { if ($neededSystem eq $systemTypes{$cur}) { $rightType = 1; - if (!defined $curJobs{$cur} or - ($curJobs{$cur} < $maxJobs{$cur})) + if ($curJobs{$cur} < $maxJobs{$cur}) { $machine = $cur; last; @@ -86,6 +89,19 @@ close IN; print "BUILDING REMOTE: $storeExpr on $machine\n"; +$curJobs{$machine} = $curJobs{$machine} + 1; + +sub writeLoad { + open LOAD, "> /home/eelco/nix/distributed/current-load" or die; + foreach my $cur (keys %machines) { + print LOAD "$cur $curJobs{$cur}\n"; + } + close LOAD; +} + +writeLoad + + my $ssh = "ssh -i $sshKeys{$machine} -x"; my $inputs = `cat inputs`; @@ -117,3 +133,7 @@ foreach my $output (split '\n', $outputs) { system "rsync -a -e '$ssh' $machine:$output /nix/store"; die "cannot rsync outputs from $machine" if ($? != 0); } + +$curJobs{$machine} = $curJobs{$machine} - 1; + +writeLoad diff --git a/distributed/remote-systems.conf b/distributed/remote-systems.conf index 4e6d2b962..3c9abc719 100644 --- a/distributed/remote-systems.conf +++ b/distributed/remote-systems.conf @@ -1,2 +1,2 @@ -scratchy.labs.cs.uu.nl i686-linux /home/eelco/.ssh/id_scratchy_auto 2 +scratchy.labs.cs.uu.nl i686-linux /home/eelco/.ssh/id_scratchy_auto 1 mckroket.labs.cs.uu.nl powerpc-mac /home/eelco/.ssh/id_scratchy_mckroket 1 diff --git a/distributed/test.sh b/distributed/test.sh index 38116eba5..78f83095e 100755 --- a/distributed/test.sh +++ b/distributed/test.sh @@ -2,8 +2,11 @@ set -e +rm -f current-load +touch current-load + storeExpr=$(nix-instantiate ~/nixpkgs/pkgs/system/test.nix) export NIX_BUILD_HOOK="build-remote.pl" -../src/nix-store/nix-store -qnvvvv -j0 $storeExpr +../src/nix-store/nix-store -qnvvvv -j1 $storeExpr diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc index 3ae3fb789..0673814ba 100644 --- a/src/libstore/normalise.cc +++ b/src/libstore/normalise.cc @@ -332,7 +332,7 @@ void Normaliser::run() while (!goals.empty()) { - printMsg(lvlVomit, "main loop"); + debug("main loop - starting jobs"); /* Start building as many buildable goals as possible. */ bool madeProgress = false; |