This commit is contained in:
Eelco Dolstra 2008-11-12 11:09:21 +00:00
parent ee13f3cc0d
commit 80a2350a0a
6 changed files with 114 additions and 17 deletions

View file

@ -46,9 +46,32 @@ sub index :Path :Args(0) {
sub project :Local {
my ( $self, $c, $projectName ) = @_;
$c->stash->{template} = 'project.tt';
(my $project) = $c->model('DB::Projects')->search({ name => $projectName });
return error($c, "Project <tt>$projectName</tt> doesn't exist.") if !defined $project;
$c->stash->{project} = $project;
$c->model('DB::Builds')->search({project => $projectName}, {join => 'resultInfo', select => {sum => 'starttime'}});
$c->stash->{finishedBuilds} = $c->model('DB::Builds')->search(
{project => $projectName, finished => 1});
$c->stash->{succeededBuilds} = $c->model('DB::Builds')->search(
{project => $projectName, finished => 1, buildStatus => 0},
{join => 'resultInfo'});
$c->stash->{scheduledBuilds} = $c->model('DB::Builds')->search(
{project => $projectName, finished => 0});
$c->stash->{busyBuilds} = $c->model('DB::Builds')->search(
{project => $projectName, finished => 0, busy => 1},
{join => 'schedulingInfo'});
$c->stash->{totalBuildTime} = $c->model('DB::Builds')->search(
{project => $projectName},
{join => 'resultInfo', select => {sum => 'stoptime - starttime'}, as => ['sum']})
->first->get_column('sum');
$c->stash->{jobNames} =
[$c->model('DB::Builds')->search({project => $projectName}, {select => [{distinct => 'attrname'}], as => ['attrname']})];
}
@ -81,6 +104,8 @@ sub build :Local {
$c->stash->{build} = $build;
$c->stash->{id} = $id;
$c->stash->{curTime} = time;
if (!$build->finished && $build->schedulingInfo->busy) {
my $logfile = $build->schedulingInfo->logfile;
$c->stash->{logtext} = `cat $logfile`;

View file

@ -140,7 +140,7 @@
<table class="tablesorter">
<thead>
<tr><th>Nr</th><th>What</th><th>Status</th></tr>
<tr><th>Nr</th><th>What</th><th>Duration</th><th>Status</th></tr>
</thead>
<tbody>
[% FOREACH step IN build.buildsteps -%]
@ -149,6 +149,13 @@
<td>
Build of <tt>[% step.outpath %]</tt>
</td>
<td>
[% IF step.busy == 0 %]
[% step.stoptime - step.starttime %]s
[% ELSE %]
[% curTime - step.starttime %]s
[% END %]
</td>
<td>
[% IF step.busy == 1 %]
<strong>Building</strong>
@ -202,6 +209,8 @@
[% END %]
[% IF build.buildlogs %]
<h2>Logs</h2>
<table>
@ -213,6 +222,8 @@
[% END -%]
</table>
[% END %]
[% IF build.dependents %]

View file

@ -2,11 +2,15 @@
<h1>All builds for job <tt>[% projectName %]:[% jobName %]</tt></h1>
<table>
<tr><th></th><th>Id</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
[% FOREACH build IN builds -%]
[% INCLUDE "short-build-info.tt" %]
[% END -%]
<table class="tablesorter">
<thead>
<tr><th></th><th>Id</th><th>Project</th><th>Job</th><th>System</th><th>Timestamp</th><th>Description</th></tr>
</thead>
<tbody>
[% FOREACH build IN builds -%]
[% INCLUDE "short-build-info.tt" %]
[% END -%]
</tbody>
</table>
[% END %]

View file

@ -9,11 +9,20 @@
<h3>Jobset <tt>[% jobset.name %]</tt></h3>
<p>
Description: [% jobset.description %]
<br />
Nix expression: <tt>[% jobset.nixexprpath %]</tt> in input <tt>[% jobset.nixexprinput %]</tt>
</p>
<h4>Information</h4>
<table>
<tr>
<th>Description:</th>
<td>[% jobset.description %]</td>
</tr>
<tr>
<th>Nix expression:</th>
<td><tt>[% jobset.nixexprpath %]</tt> in input <tt>[% jobset.nixexprinput %]</tt></td>
</tr>
</table>
<h4>Inputs</h4>
<table class="tablesorter">
<thead>
@ -50,5 +59,34 @@
</ul>
<h2>Statistics</h2>
<table>
<tr>
<th>Finished builds:</th>
<td>[% finishedBuilds %]</td>
</tr>
<tr>
<th><img src="/static/images/success.gif" /> Succeeded builds:</th>
<td>[% succeededBuilds %]</td>
</tr>
<tr>
<th><img src="/static/images/failure.gif" /> Failed builds:</th>
<td>[% finishedBuilds - succeededBuilds %]</td>
</tr>
<tr>
<th>Total build time:</th>
<td>[% totalBuildTime %]s</td>
</tr>
<tr>
<th>Scheduled builds:</th>
<td>[% scheduledBuilds %]</td>
</tr>
<tr>
<th>Currently executing builds:</th>
<td>[% busyBuilds %]</td>
</tr>
</table>
[% END %]

View file

@ -59,6 +59,7 @@ sub doBuild {
, outpath => $2
, logfile => $4
, busy => 1
, starttime => time
});
});
}
@ -71,6 +72,7 @@ sub doBuild {
die unless $step;
$step->busy(0);
$step->status(0);
$step->stoptime(time);
$step->update;
});
}
@ -80,11 +82,28 @@ sub doBuild {
my $drvPath = $1;
(my $step) = $db->resultset('Buildsteps')->search(
{id => $build->id, type => 0, drvpath => $drvPath}, {});
die unless $step;
$step->busy(0);
$step->status(1);
$step->errormsg($4);
$step->update;
if ($step) {
die unless $step;
$step->busy(0);
$step->status(1);
$step->errormsg($4);
$step->stoptime(time);
$step->update;
} else {
$db->resultset('Buildsteps')->create(
{ id => $build->id
, stepnr => $buildStepNr++
, type => 0 # = build
, drvpath => $drvPath
, outpath => $2
, logfile => $4
, busy => 0
, status => 1
, starttime => time
, stoptime => time
, errormsg => $4
});
}
});
}
}

View file

@ -90,5 +90,5 @@ while (1) {
warn $@ if $@;
print "sleeping...\n";
sleep(10);
sleep(5);
}