Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

hydra-queue-runner: Use nix.machines instead of the SystemTypes table…

… to determine how many build jobs are allowed per system type.

Note that on machines that support multiple system types, EACH system type gets the full number of build slots, which is almost certainly not what we want.
  • Loading branch information...
commit d764c135ce6f0331d78f98f8ff4fe1a85810d8db 1 parent 233e485
@shlevy shlevy authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/script/hydra-queue-runner
View
17 src/script/hydra-queue-runner
@@ -73,6 +73,16 @@ sub checkBuilds {
my @buildsStarted;
+ my $machines = getMachines;
+
+ my %maxConcurrent = ();
+
+ foreach my $machineName (keys %{$machines}) {
+ foreach my $system (${$machines}{$machineName}{'systemTypes'}) {
+ $maxConcurrent{$system} = (${$machines}{$machineName}{'maxJobs'} or 0) + ($maxConcurrent{$system} or 0)
+ }
+ }
+
txn_do($db, sub {
# Get the system types for the runnable builds.
@@ -89,10 +99,7 @@ sub checkBuilds {
my $nrActive = $db->resultset('Builds')->search(
{finished => 0, busy => 1, system => $system->system})->count;
- # How many extra builds can we start?
- (my $systemTypeInfo) = $db->resultset('SystemTypes')->search({system => $system->system});
- my $maxConcurrent = defined $systemTypeInfo ? $systemTypeInfo->maxconcurrent : 2;
- my $extraAllowed = $maxConcurrent - $nrActive;
+ my $extraAllowed = $maxConcurrent{$system} - $nrActive;
$extraAllowed = 0 if $extraAllowed < 0;
# Select the highest-priority builds to start.
@@ -102,7 +109,7 @@ sub checkBuilds {
rows => $extraAllowed });
print "system type `", $system->system,
- "': $nrActive active, $maxConcurrent allowed, ",
+ "': $nrActive active, $maxConcurrent{$system} allowed, ",
"starting ", scalar(@builds), " builds\n";
foreach my $build (@builds) {

1 comment on commit d764c13

@edolstra
Owner

I guess that's an argument for keeping the SystemTypes table, but only use it as an override of the concurrency values in nix.machines.

Please sign in to comment.
Something went wrong with that request. Please try again.