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

@ -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);