diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-05-13T22·52+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-05-13T22·52+0000 |
commit | 4fc00cbec139487e63a7edf6225a8590ed58a9f3 (patch) | |
tree | b2477bb8c3c0c8e15238c6d060f87d83eb93ad60 /distributed | |
parent | 2fa33049338aed07465f73b25c95168d6a61c8b5 (diff) |
* Distributed builds and load balancing now seem to work pretty well.
(Though the `build-remote.pl' script has a gigantic race condition).
Diffstat (limited to 'distributed')
-rwxr-xr-x | distributed/build-remote.pl | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/distributed/build-remote.pl b/distributed/build-remote.pl index 12cb272b95fa..44482530b30e 100755 --- a/distributed/build-remote.pl +++ b/distributed/build-remote.pl @@ -80,6 +80,21 @@ if (!defined $machine) { } } +sub writeLoad { + system "echo A >> /tmp/blaaaa"; + open LOAD, "> /home/eelco/nix/distributed/current-load" or die; + system "echo B >> /tmp/blaaaa"; + foreach my $cur (keys %machines) { + system "echo $cur $curJobs{$cur} >> /tmp/blaaaa"; + print LOAD "$cur $curJobs{$cur}\n"; + } + system "echo C >> /tmp/blaaaa"; + close LOAD; +} + +$curJobs{$machine} = $curJobs{$machine} + 1; +writeLoad; + sendReply "accept"; open IN, "<&4" or die; my $x = <IN>; @@ -87,30 +102,27 @@ chomp $x; print "got $x\n"; close IN; -print "BUILDING REMOTE: $storeExpr on $machine\n"; - -$curJobs{$machine} = $curJobs{$machine} + 1; +system "echo $x >> /tmp/blaaaa"; +system "echo $curJobs{$machine} >> /tmp/blaaaa"; -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; +if ($x ne "okay") { + $curJobs{$machine} = $curJobs{$machine} - 1; + system "echo $curJobs{$machine} >> /tmp/blaaaa"; + writeLoad; + exit 0; } -writeLoad - +print "BUILDING REMOTE: $storeExpr on $machine\n"; my $ssh = "ssh -i $sshKeys{$machine} -x"; -my $inputs = `cat inputs`; +my $inputs = `cat inputs` or die; $inputs =~ s/\n/ /g; -my $outputs = `cat outputs`; +my $outputs = `cat outputs` or die; $outputs =~ s/\n/ /g; -my $successors = `cat successors`; +my $successors = `cat successors` or die; $successors =~ s/\n/ /g; system "rsync -a -e '$ssh' $storeExpr $inputs $machine:/nix/store"; @@ -136,4 +148,4 @@ foreach my $output (split '\n', $outputs) { $curJobs{$machine} = $curJobs{$machine} - 1; -writeLoad +writeLoad; |