Hydra/17: in queue runner, prefer builds in the queue that are a dependency of another build (with higher priority)

This commit is contained in:
Rob Vermaas 2010-04-23 11:33:06 +00:00
parent 85928a4222
commit 1d0598272e

View file

@ -55,15 +55,16 @@ sub findBuildDependencyInQueue {
my $drvpath = $build->drvpath; my $drvpath = $build->drvpath;
my @paths = reverse(split '\n', `nix-store -qR $drvpath`); my @paths = reverse(split '\n', `nix-store -qR $drvpath`);
my $depBuild;
foreach my $path (@paths) { foreach my $path (@paths) {
if($path ne $drvpath) { 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 }, { drvpath => $path, finished => 0, busy => 0, enabled => 1, disabled => 0 },
{ join => ['schedulingInfo', 'project'], rows => 1 } ) ; { join => ['schedulingInfo', 'project'], rows => 1 } ) ;
return $depBuild if defined $depBuild; return $depBuild if defined $depBuild;
} }
} }
return $build ; return $depBuild;
} }
sub checkBuilds { sub checkBuilds {
@ -105,7 +106,10 @@ sub checkBuilds {
"starting ", scalar(@builds), " builds\n"; "starting ", scalar(@builds), " builds\n";
foreach my $build (@builds) { foreach my $build (@builds) {
$build = findBuildDependencyInQueue($build); my $depbuild = findBuildDependencyInQueue($build);
if(defined $depbuild) {
$build = $depbuild;
}
my $logfile = getcwd . "/logs/" . $build->id; my $logfile = getcwd . "/logs/" . $build->id;
mkdir(dirname $logfile); mkdir(dirname $logfile);