diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-08-27T13·18+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-08-27T13·18+0000 |
commit | 766f7084188d8c0dd0595bbbfc50fbc4f9d67a50 (patch) | |
tree | 2860458de610cf2e9b39cca440332b789e44f240 /scripts | |
parent | e41ecbf7303a181fd37026edb72f2f23dde7e73b (diff) |
* Experimental feature: allow a derivation to tell the build hook that
it requires a certain feature on the build machine, e.g. requiredSystemFeatures = [ "kvm" ]; We need this in Hydra to make sure that builds that require KVM support are forwarded to machines that have KVM support. Probably this should also be enforced for local builds.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build-remote.pl.in | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in index a8f73f2e541c..0c8081a0bc11 100755 --- a/scripts/build-remote.pl.in +++ b/scripts/build-remote.pl.in @@ -36,6 +36,8 @@ sub sendReply { print STDERR "# $reply\n"; } +sub all { $_ || return 0 for @_; 1 } + # Initialisation. my $loadIncreased = 0; @@ -64,13 +66,14 @@ if (defined $conf && -e $conf) { chomp; s/\#.*$//g; next if /^\s*$/; - /^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\d+)(\s+([0-9\.]+))?\s*$/ or die; + my @tokens = split /\s/, $_; push @machines, - { hostName => $1 - , systemTypes => [split(/,/, $2)] - , sshKeys => $3 - , maxJobs => $4 - , speedFactor => 1.0 * ($6 || 1) + { hostName => $tokens[0] + , systemTypes => [ split(/,/, $tokens[1]) ] + , sshKeys => $tokens[2] + , maxJobs => int($tokens[3]) + , speedFactor => 1.0 * (defined $tokens[4] ? int($tokens[4]) : 1) + , features => [ split(/,/, $tokens[5] || "") ] , enabled => 1 }; } @@ -85,7 +88,8 @@ my ($drvPath, $hostName, $slotLock); REQ: while (1) { $_ = <STDIN> || exit 0; my ($amWilling, $neededSystem); - ($amWilling, $neededSystem, $drvPath) = split; + ($amWilling, $neededSystem, $drvPath, $requiredFeatures) = split; + my @requiredFeatures = split /,/, $requiredFeatures; my $canBuildLocally = $amWilling && ($localSystem eq $neededSystem); @@ -103,12 +107,15 @@ REQ: while (1) { while (1) { # Find all machine that can execute this build, i.e., that - # support builds for the given platform and are not at their - # job limit. + # support builds for the given platform and features, and are + # not at their job limit. my $rightType = 0; my @available = (); LOOP: foreach my $cur (@machines) { - if ($cur->{enabled} && grep { $neededSystem eq $_ } @{$cur->{systemTypes}}) { + if ($cur->{enabled} + && (grep { $neededSystem eq $_ } @{$cur->{systemTypes}}) + && all(map { my $f = $_; 0 != grep { $f eq $_ } @{$cur->{features}} } @requiredFeatures)) + { $rightType = 1; # We have a machine of the right type. Determine the load on |