* minor performance tweaks

* added related builds tab which show related builds (builds that are in same evaluations), shows max 50
This commit is contained in:
Rob Vermaas 2012-02-16 16:56:01 +01:00
parent 355135b6e8
commit 924d94cafd
4 changed files with 47 additions and 29 deletions

View file

@ -81,6 +81,13 @@ sub view_build : Chained('build') PathPart('') Args(0) {
]; ];
} }
my $r = joinWithResultInfo( $c, $c->model('DB::Builds'))->search(
{ eval => { -in => $build->jobsetevalmembers->get_column('eval')->as_query } }
, { join => 'jobsetevalmembers', order_by => [ 'project', 'jobset', 'job'] }
);
if ($r->count <= 50) {
$c->stash->{relatedbuilds} = [$r->all];
}
} }

View file

@ -105,7 +105,7 @@ sub joinWithResultInfo {
{ }, { },
{ join => 'resultInfo' { join => 'resultInfo'
, '+select' => ["resultInfo.releasename", "resultInfo.buildstatus"] , '+select' => ["resultInfo.releasename", "resultInfo.buildstatus"]
, '+as' => ["releasename", "buildstatus"] , '+as' => ["releasename", "buildStatus"]
}); });
} }

View file

@ -7,6 +7,7 @@
[% project = build.project %] [% project = build.project %]
[% jobset = build.jobset %] [% jobset = build.jobset %]
[% job = build.job %] [% job = build.job %]
[% resultInfo = build.resultInfo %]
[% BLOCK renderBuildSteps %] [% BLOCK renderBuildSteps %]
@ -34,7 +35,7 @@
[% INCLUDE renderDuration duration = step.stoptime - step.starttime %] [% INCLUDE renderDuration duration = step.stoptime - step.starttime %]
[% ELSE %] [% ELSE %]
[% IF build.finished %] [% IF build.finished %]
[% INCLUDE renderDuration duration = build.resultInfo.stoptime - step.starttime %] [% INCLUDE renderDuration duration = resultInfo.stoptime - step.starttime %]
[% ELSE %] [% ELSE %]
[% INCLUDE renderDuration duration = curTime - step.starttime %] [% INCLUDE renderDuration duration = curTime - step.starttime %]
[% END %] [% END %]
@ -87,6 +88,7 @@
<li><a href="#tabs-summary">Summary</a></li> <li><a href="#tabs-summary">Summary</a></li>
<li><a href="#tabs-information">Information</a></li> <li><a href="#tabs-information">Information</a></li>
<li><a href="#tabs-buildinputs">Build Inputs</a></li> <li><a href="#tabs-buildinputs">Build Inputs</a></li>
[% IF relatedbuilds %]<li><a href="#tabs-relatedbuilds">Related builds</a></li>[% END %]
[% IF build.buildsteps %]<li><a href="#tabs-buildsteps">Build Steps</a></li>[% END %] [% IF build.buildsteps %]<li><a href="#tabs-buildsteps">Build Steps</a></li>[% END %]
[% IF build.dependents %]<li><a href="#tabs-usedby">Used by</a></li>[% END%] [% IF build.dependents %]<li><a href="#tabs-usedby">Used by</a></li>[% END%]
[% IF prevBuilds %]<li><a href="#tabs-history">History chart</a></li>[% END %] [% IF prevBuilds %]<li><a href="#tabs-history">History chart</a></li>[% END %]
@ -104,10 +106,10 @@
<th>Build ID:</th> <th>Build ID:</th>
<td>[% build.id %]</td> <td>[% build.id %]</td>
</tr> </tr>
[% IF build.resultInfo.releasename %] [% IF resultInfo.releasename %]
<tr> <tr>
<th>Release name:</th> <th>Release name:</th>
<td><tt>[% HTML.escape(build.resultInfo.releasename) %]</tt></td> <td><tt>[% HTML.escape(resultInfo.releasename) %]</tt></td>
</tr> </tr>
[% ELSE %] [% ELSE %]
<tr> <tr>
@ -129,15 +131,15 @@
<tr> <tr>
<th>Duration:</th> <th>Duration:</th>
<td> <td>
[% IF build.resultInfo.iscachedbuild %] [% IF resultInfo.iscachedbuild %]
(cached[% IF cachedBuild %] from [% INCLUDE renderFullBuildLink build=cachedBuild %][% END %]) (cached[% IF cachedBuild %] from [% INCLUDE renderFullBuildLink build=cachedBuild %][% END %])
[% ELSE %] [% ELSE %]
[% INCLUDE renderDuration duration = build.resultInfo.stoptime - build.resultInfo.starttime %] <tt>finished at [% INCLUDE renderDateTime timestamp = build.resultInfo.stoptime %]</tt> [% INCLUDE renderDuration duration = resultInfo.stoptime - resultInfo.starttime %] <tt>finished at [% INCLUDE renderDateTime timestamp = resultInfo.stoptime %]</tt>
[% END %] [% END %]
</td> </td>
</tr> </tr>
[% END %] [% END %]
[% IF build.resultInfo.logfile %] [% IF resultInfo.logfile %]
<tr> <tr>
<th>Logfile:</th> <th>Logfile:</th>
<td> <td>
@ -180,7 +182,7 @@
[% END %] [% END %]
[% IF build.finished %] [% IF build.finished %]
[% IF build.buildsteps && build.resultInfo.buildstatus != 0 && build.resultInfo.buildstatus != 6 %] [% IF build.buildsteps && resultInfo.buildstatus != 0 && resultInfo.buildstatus != 6 %]
[% INCLUDE renderBuildSteps type="Failed" %] [% INCLUDE renderBuildSteps type="Failed" %]
[% END %] [% END %]
@ -212,11 +214,11 @@
</table> </table>
[% END %] [% END %]
[% IF build.resultInfo.errormsg && build.resultInfo.buildstatus != 5 %] [% IF resultInfo.errormsg && resultInfo.buildstatus != 5 %]
<h2 id="nix-error">Nix error output</h2> <h2 id="nix-error">Nix error output</h2>
<pre class="buildlog">[% HTML.escape(build.resultInfo.errormsg) -%]</pre> <pre class="buildlog">[% HTML.escape(resultInfo.errormsg) -%]</pre>
[% END %] [% END %]
[% END %] [% END %]
[% IF logtext %] [% IF logtext %]
@ -262,10 +264,10 @@
<th>Nix name:</th> <th>Nix name:</th>
<td><tt>[% build.nixname %]</tt></td> <td><tt>[% build.nixname %]</tt></td>
</tr> </tr>
[% IF build.resultInfo.releasename %] [% IF resultInfo.releasename %]
<tr> <tr>
<th>Release name:</th> <th>Release name:</th>
<td><tt>[% HTML.escape(build.resultInfo.releasename) %]</tt></td> <td><tt>[% HTML.escape(resultInfo.releasename) %]</tt></td>
</tr> </tr>
[% END %] [% END %]
<tr> <tr>
@ -324,8 +326,8 @@
<th>Time added:</th> <th>Time added:</th>
<td>[% INCLUDE renderDateTime timestamp = build.timestamp %]</td> <td>[% INCLUDE renderDateTime timestamp = build.timestamp %]</td>
</tr> </tr>
[% IF build.finished && build.resultInfo.buildstatus != 4 %] [% IF build.finished && resultInfo.buildstatus != 4 %]
[% IF build.resultInfo.iscachedbuild && cachedBuild %] [% IF resultInfo.iscachedbuild && cachedBuild %]
<tr> <tr>
<th>Cached build:</th> <th>Cached build:</th>
<td>[% INCLUDE renderFullBuildLink build=cachedBuild %]</td> <td>[% INCLUDE renderFullBuildLink build=cachedBuild %]</td>
@ -334,23 +336,23 @@
<tr> <tr>
<th>Build started:</th> <th>Build started:</th>
<td>[% IF build.resultInfo.starttime %][% INCLUDE renderDateTime timestamp = build.resultInfo.starttime %][% ELSE %]<em>(cached build)</em>[% END %]</td> <td>[% IF resultInfo.starttime %][% INCLUDE renderDateTime timestamp = resultInfo.starttime %][% ELSE %]<em>(cached build)</em>[% END %]</td>
</tr> </tr>
<tr> <tr>
<th>Build finished:</th> <th>Build finished:</th>
<td>[% IF build.resultInfo.stoptime %][% INCLUDE renderDateTime timestamp = build.resultInfo.stoptime %][% ELSE %]<em>(cached build)</em>[% END %]</td> <td>[% IF resultInfo.stoptime %][% INCLUDE renderDateTime timestamp = resultInfo.stoptime %][% ELSE %]<em>(cached build)</em>[% END %]</td>
</tr> </tr>
<tr> <tr>
<th>Duration:</th> <th>Duration:</th>
<td> <td>
[% IF build.resultInfo.iscachedbuild %] [% IF resultInfo.iscachedbuild %]
<em>(cached build)</em> <em>(cached build)</em>
[% ELSE %] [% ELSE %]
[% INCLUDE renderDuration duration = build.resultInfo.stoptime - build.resultInfo.starttime %] [% INCLUDE renderDuration duration = resultInfo.stoptime - resultInfo.starttime %]
[% END %] [% END %]
</td> </td>
</tr> </tr>
[% IF build.resultInfo.logfile %] [% IF resultInfo.logfile %]
<tr> <tr>
<th>Logfile:</th> <th>Logfile:</th>
<td> <td>
@ -373,7 +375,7 @@
<td> <td>
[% IF !available %] [% IF !available %]
<em>Build output is no longer available</em> <em>Build output is no longer available</em>
[% ELSIF build.resultInfo.keep %] [% ELSIF resultInfo.keep %]
<em>Build output will be kept permanently</em> <em>Build output will be kept permanently</em>
[% IF c.user_exists %] [% IF c.user_exists %]
<form action="[% c.uri_for('/build' build.id 'keep' 0) %]" method="post" class="inline"> <form action="[% c.uri_for('/build' build.id 'keep' 0) %]" method="post" class="inline">
@ -431,6 +433,13 @@
</div> </div>
[% IF relatedbuilds %]
<div id="tabs-relatedbuilds">
<h2>Related builds</h2>
[% INCLUDE renderBuildList builds=relatedbuilds%]
</div>
[% END %]
[% IF build.buildsteps %] [% IF build.buildsteps %]
<div id="tabs-buildsteps"> <div id="tabs-buildsteps">
@ -476,8 +485,9 @@
var d = []; var d = [];
var ids = []; var ids = [];
[% FOREACH prevbuild IN prevBuilds %][% IF prevbuild.resultInfo.starttime != 0 %] [% FOREACH prevbuild IN prevBuilds %][% IF prevbuild.resultInfo.starttime != 0 %]
d.push([[% prevbuild.resultInfo.starttime * 1000 %],[% prevbuild.get_column('actualBuildTime') %]]); [% pbResultInfo = prevbuild.resultInfo %]
ids[[% prevbuild.resultInfo.starttime * 1000 %]] = [% prevbuild.id %] ; d.push([[% pbResultInfo.starttime * 1000 %],[% prevbuild.get_column('actualBuildTime') %]]);
ids[[% pbResultInfo.starttime * 1000 %]] = [% prevbuild.id %] ;
[% END %][% END %] [% END %][% END %]
var options = { var options = {

View file

@ -230,26 +230,27 @@
[% BLOCK renderStatus %] [% BLOCK renderStatus %]
[% IF build.finished %] [% IF build.finished %]
[% buildstatus = build.resultInfo.buildstatus %]
[% INCLUDE renderBuildStatusIcon size=16 %] [% INCLUDE renderBuildStatusIcon size=16 %]
[% IF build.resultInfo.buildstatus == 0 %] [% IF buildstatus == 0 %]
<strong>Success</strong> <strong>Success</strong>
[% ELSIF build.resultInfo.buildstatus == 1 %] [% ELSIF buildstatus == 1 %]
<span class="error">Build returned a non-zero exit code</span> <span class="error">Build returned a non-zero exit code</span>
[% ELSIF build.resultInfo.buildstatus == 2 %] [% ELSIF buildstatus == 2 %]
<span class="error">A dependency of the build failed</span> <span class="error">A dependency of the build failed</span>
[% ELSIF build.resultInfo.buildstatus == 4 %] [% ELSIF buildstatus == 4 %]
<span class="error">Cancelled by user</span> <span class="error">Cancelled by user</span>
[% ELSIF build.resultInfo.buildstatus == 5 %] [% ELSIF buildstatus == 5 %]
<span class="error">Build inhibited because a dependency previously failed to build</span> <span class="error">Build inhibited because a dependency previously failed to build</span>
[% failedDep = build.resultInfo.failedDep %] [% failedDep = build.resultInfo.failedDep %]
(namely, <a href="[% c.uri_for('/build' failedDep.build.id 'nixlog' failedDep.stepnr) %]"><tt>[% failedDep.outpath %]</tt></a>) (namely, <a href="[% c.uri_for('/build' failedDep.build.id 'nixlog' failedDep.stepnr) %]"><tt>[% failedDep.outpath %]</tt></a>)
[% ELSIF build.resultInfo.buildstatus == 6 %] [% ELSIF buildstatus == 6 %]
<span class="error">Build failed (with result)</span> <span class="error">Build failed (with result)</span>
[% ELSE %] [% ELSE %]
<span class="error">Build failed</span> <span class="error">Build failed</span>
(see <a href="#nix-error">below</a>) (see <a href="#nix-error">below</a>)
[% END %] [% END %]
[% IF c.user_exists && (build.resultInfo.buildstatus == 3 || build.resultInfo.buildstatus == 4) %] [% IF c.user_exists && (buildstatus == 3 || buildstatus == 4) %]
<form action="[% c.uri_for('/build' build.id 'restart') %]" method="post" class="inline"> <form action="[% c.uri_for('/build' build.id 'restart') %]" method="post" class="inline">
<button id="restart" type="submit">Restart</button> <button id="restart" type="submit">Restart</button>
</form> </form>