forked from lix-project/hydra
Merge branch 'queue-17'
This commit is contained in:
parent
9eaaa0c1e9
commit
8fb3d901cb
|
@ -6,7 +6,7 @@ use File::Basename;
|
||||||
use POSIX qw(dup2 :sys_wait_h);
|
use POSIX qw(dup2 :sys_wait_h);
|
||||||
use Hydra::Schema;
|
use Hydra::Schema;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
|
use Nix;
|
||||||
|
|
||||||
chdir getHydraPath or die;
|
chdir getHydraPath or die;
|
||||||
my $db = openHydraDB;
|
my $db = openHydraDB;
|
||||||
|
@ -50,6 +50,21 @@ sub unlockDeadBuilds {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub findBuildDependencyInQueue {
|
||||||
|
my ($build) = @_;
|
||||||
|
my $drvpath = $build->drvpath;
|
||||||
|
my @paths = reverse(split '\n', `nix-store -qR $drvpath`);
|
||||||
|
|
||||||
|
foreach my $path (@paths) {
|
||||||
|
if($path ne $drvpath) {
|
||||||
|
(my $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 ;
|
||||||
|
}
|
||||||
|
|
||||||
sub checkBuilds {
|
sub checkBuilds {
|
||||||
print "looking for runnable builds...\n";
|
print "looking for runnable builds...\n";
|
||||||
|
@ -62,7 +77,7 @@ sub checkBuilds {
|
||||||
my @systemTypes = $db->resultset('Builds')->search(
|
my @systemTypes = $db->resultset('Builds')->search(
|
||||||
{ finished => 0, busy => 0, enabled => 1, disabled => 0 },
|
{ finished => 0, busy => 0, enabled => 1, disabled => 0 },
|
||||||
{ join => ['schedulingInfo', 'project'], select => ['system'], as => ['system'], distinct => 1 });
|
{ join => ['schedulingInfo', 'project'], select => ['system'], as => ['system'], distinct => 1 });
|
||||||
|
|
||||||
# For each system type, select up to the maximum number of
|
# For each system type, select up to the maximum number of
|
||||||
# concurrent build for that system type. Choose the highest
|
# concurrent build for that system type. Choose the highest
|
||||||
# priority builds first, then the oldest builds.
|
# priority builds first, then the oldest builds.
|
||||||
|
@ -90,6 +105,8 @@ sub checkBuilds {
|
||||||
"starting ", scalar(@builds), " builds\n";
|
"starting ", scalar(@builds), " builds\n";
|
||||||
|
|
||||||
foreach my $build (@builds) {
|
foreach my $build (@builds) {
|
||||||
|
$build = findBuildDependencyInQueue($build);
|
||||||
|
|
||||||
my $logfile = getcwd . "/logs/" . $build->id;
|
my $logfile = getcwd . "/logs/" . $build->id;
|
||||||
mkdir(dirname $logfile);
|
mkdir(dirname $logfile);
|
||||||
unlink($logfile);
|
unlink($logfile);
|
||||||
|
|
Loading…
Reference in a new issue