Author: eelco
Date: Tue Aug 31 16:19:33 2010
New Revision: 23570
URL: https://svn.nixos.org/websvn/nix/?rev=23570&sc=1
Log:
* Speed up findBuildDependencyInQueue by doing only one SQL query for
all the dependencies (`drvpath => [ @drvs ]' is an OR).
Modified:
hydra/trunk/src/script/hydra_queue_runner.pl
Modified: hydra/trunk/src/script/hydra_queue_runner.pl
==============================================================================
--- hydra/trunk/src/script/hydra_queue_runner.pl Tue Aug 31 15:54:08
2010 (r23569)
+++ hydra/trunk/src/script/hydra_queue_runner.pl Tue Aug 31 16:19:33
2010 (r23570)
@@ -50,23 +50,27 @@
});
}
+
sub findBuildDependencyInQueue {
my ($build) = @_;
my $drvpath = $build->drvpath;
my @paths = reverse(split '\n', `nix-store -qR $drvpath`);
- my $depBuild;
+ my $depBuild;
+ my @drvs = ();
foreach my $path (@paths) {
- if($path ne $drvpath) {
- ($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 $depBuild;
+ push @drvs, $path if $path =~ /\.drv$/ && $path ne $drvpath;
+ }
+
+ return unless scalar @drvs > 0;
+
+ ($depBuild) = $db->resultset('Builds')->search(
+ { drvpath => [ @drvs ], finished => 0, busy => 0, enabled => 1,
disabled => 0 },
+ { join => ['schedulingInfo', 'project'], rows => 1 } ) ;
+ return $depBuild;
}
+
sub checkBuilds {
print "looking for runnable builds...\n";
@@ -107,9 +111,7 @@
foreach my $build (@builds) {
my $depbuild = findBuildDependencyInQueue($build);
- if(defined $depbuild) {
- $build = $depbuild;
- }
+ $build = $depbuild if defined $depbuild;
my $logfile = getcwd . "/logs/" . $build->id;
mkdir(dirname $logfile);
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits