From 68c60b4c6670795c12fb562e52f7039a03c7512c Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Thu, 11 Feb 2010 12:23:46 +0000 Subject: [PATCH] * hydra: added index, actual build time (buildstep with same outpath, so without deps) of the build --- src/lib/Hydra/Controller/Build.pm | 8 +++++++- src/lib/Hydra/Schema/Builds.pm | 8 ++++++++ src/root/build.tt | 2 +- src/sql/hydra.sql | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 262b510a..16714155 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -58,8 +58,14 @@ sub view_build : Chained('build') PathPart('') Args(0) { , system => $build->system , finished => 1 , buildstatus => 0 + , 'me.id' => { '<=' => $build->id } + } + , { join => "actualBuildStep" + , "+select" => ["actualBuildStep.stoptime - actualBuildStep.starttime"] + , "+as" => ["actualBuildTime"] + , order_by => "id DESC" + , rows => 50 } - , { order_by => "id DESC", rows => 100 } ) ]; } diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 1b2452df..e2ecbdbb 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -217,6 +217,14 @@ __PACKAGE__->belongs_to( { id => "id" }, ); +__PACKAGE__->has_one( + "actualBuildStep", + "Hydra::Schema::BuildSteps", + { 'foreign.outpath' => 'self.outpath' + , 'foreign.build' => 'self.id' + }, +); + sub addSequence { my $hydradbi = getHydraDBPath; if ($hydradbi =~ m/^dbi:Pg/) { diff --git a/src/root/build.tt b/src/root/build.tt index fe0986d5..1473ddef 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -430,7 +430,7 @@ var d = []; var ids = []; [% FOREACH prevbuild IN prevBuilds %][% IF prevbuild.resultInfo.starttime != 0 %] - d.push([[% prevbuild.resultInfo.starttime * 1000 %],[% prevbuild.resultInfo.stoptime - prevbuild.resultInfo.starttime %]]); + d.push([[% prevbuild.resultInfo.starttime * 1000 %],[% prevbuild.get_column('actualBuildTime') %]]); ids[[% prevbuild.resultInfo.starttime * 1000 %]] = [% prevbuild.id %] ; [% END %][% END %] diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 8a3e7108..938e2224 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -431,6 +431,7 @@ create index IndexBuildSchedulingInfoOnBuild on BuildSchedulingInfo(id); -- idem create index IndexBuildStepsOnBuild on BuildSteps(build); create index IndexBuildStepsOnDrvpathTypeBusyStatus on BuildSteps(drvpath, type, busy, status); create index IndexBuildStepsOnOutpath on BuildSteps(outpath); +create index IndexBuildStepsOnOutpathBuild on BuildSteps (outpath, build); create index IndexBuildsOnFinished on Builds(finished); create index IndexBuildsOnIsCurrent on Builds(isCurrent); create index IndexBuildsOnJob on Builds(project, jobset, job);