From 1d0598272e5c442a8c2ef03b7a904286179601e1 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Fri, 23 Apr 2010 11:33:06 +0000 Subject: [PATCH] Hydra/17: in queue runner, prefer builds in the queue that are a dependency of another build (with higher priority) --- src/script/hydra_queue_runner.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/script/hydra_queue_runner.pl b/src/script/hydra_queue_runner.pl index 8213d5f2..e449c2a1 100755 --- a/src/script/hydra_queue_runner.pl +++ b/src/script/hydra_queue_runner.pl @@ -54,16 +54,17 @@ sub findBuildDependencyInQueue { my ($build) = @_; my $drvpath = $build->drvpath; my @paths = reverse(split '\n', `nix-store -qR $drvpath`); - + + my $depBuild; foreach my $path (@paths) { if($path ne $drvpath) { - (my $depBuild) = $db->resultset('Builds')->search( + ($depBuild) = $db->resultset('Builds')->search( { drvpath => $path, finished => 0, busy => 0, enabled => 1, disabled => 0 }, { join => ['schedulingInfo', 'project'], rows => 1 } ) ; return $depBuild if defined $depBuild; } } - return $build ; + return $depBuild; } sub checkBuilds { @@ -105,7 +106,10 @@ sub checkBuilds { "starting ", scalar(@builds), " builds\n"; foreach my $build (@builds) { - $build = findBuildDependencyInQueue($build); + my $depbuild = findBuildDependencyInQueue($build); + if(defined $depbuild) { + $build = $depbuild; + } my $logfile = getcwd . "/logs/" . $build->id; mkdir(dirname $logfile);