From b302e5f63b96c945fa66d391c2d3165d7003a297 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 22 Jun 2004 15:06:43 +0000 Subject: [PATCH] * We don't really need this here. --- distributed/build-remote.pl | 151 -------------------------------- distributed/remote-systems.conf | 2 - distributed/test.sh | 12 --- 3 files changed, 165 deletions(-) delete mode 100755 distributed/build-remote.pl delete mode 100644 distributed/remote-systems.conf delete mode 100755 distributed/test.sh diff --git a/distributed/build-remote.pl b/distributed/build-remote.pl deleted file mode 100755 index 44482530b3..0000000000 --- a/distributed/build-remote.pl +++ /dev/null @@ -1,151 +0,0 @@ -#! /usr/bin/perl -w - -use strict; - -my $amWilling = shift @ARGV; -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)) { - sendReply "decline"; - exit 0; -} - -# Otherwise find a willing remote machine. -my %machines; -my %systemTypes; -my %sshKeys; -my %maxJobs; -my %curJobs; - -# Read the list of machines. -open CONF, "< /home/eelco/nix/distributed/remote-systems.conf" or die; - -while () { - chomp; - next if /^\s*$/; - /^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\d+)\s*$/ or die; - $machines{$1} = ""; - $systemTypes{$1} = $2; - $sshKeys{$1} = $3; - $maxJobs{$1} = $4; -} - -close CONF; - -# Read the current load status. -open LOAD, "< /home/eelco/nix/distributed/current-load" or die; -while () { - chomp; - next if /^\s*$/; - /^\s*(\S+)\s+(\d+)\s*$/ or die; - $curJobs{$1} = $2; -} -close LOAD; - -foreach my $cur (keys %machines) { - $curJobs{$cur} = 0 unless defined $curJobs{$cur}; -} - -# Find a suitable system. -my $rightType = 0; -my $machine; -foreach my $cur (keys %machines) { - if ($neededSystem eq $systemTypes{$cur}) { - $rightType = 1; - if ($curJobs{$cur} < $maxJobs{$cur}) - { - $machine = $cur; - last; - } - } -} - -if (!defined $machine) { - if ($rightType) { - sendReply "postpone"; - exit 0; - } else { - sendReply "decline"; - exit 0; - } -} - -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 = ; -chomp $x; -print "got $x\n"; -close IN; - -system "echo $x >> /tmp/blaaaa"; -system "echo $curJobs{$machine} >> /tmp/blaaaa"; - -if ($x ne "okay") { - $curJobs{$machine} = $curJobs{$machine} - 1; - system "echo $curJobs{$machine} >> /tmp/blaaaa"; - writeLoad; - exit 0; -} - -print "BUILDING REMOTE: $storeExpr on $machine\n"; - -my $ssh = "ssh -i $sshKeys{$machine} -x"; - -my $inputs = `cat inputs` or die; -$inputs =~ s/\n/ /g; - -my $outputs = `cat outputs` or die; -$outputs =~ s/\n/ /g; - -my $successors = `cat successors` or die; -$successors =~ s/\n/ /g; - -system "rsync -a -e '$ssh' $storeExpr $inputs $machine:/nix/store"; -die "cannot rsync inputs to $machine" if ($? != 0); - -system "$ssh $machine /nix/bin/nix-store --validpath $storeExpr $inputs"; -die "cannot set valid paths on $machine" if ($? != 0); - -system "$ssh $machine /nix/bin/nix-store --successor $successors"; -die "cannot set successors on $machine" if ($? != 0); - -print "BUILDING...\n"; - -system "$ssh $machine /nix/bin/nix-store -qnfvvvv $storeExpr"; -die "remote build on $machine failed" if ($? != 0); - -print "REMOTE BUILD DONE\n"; - -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 deleted file mode 100644 index 3c9abc7194..0000000000 --- a/distributed/remote-systems.conf +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100755 index c91595da0b..0000000000 --- a/distributed/test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh - -set -e - -rm -f current-load -touch current-load - -storeExpr=$(nix-instantiate ~/nixpkgs/pkgs/system/all.nix) - -export NIX_BUILD_HOOK="build-remote.pl" - -../src/nix-store/nix-store -qnvvvv -j1 $storeExpr