* Store build duration, handle cached builds.

This commit is contained in:
Eelco Dolstra
2008-10-28 17:08:29 +00:00
parent 08798f3c07
commit 5915bcaba3
10 changed files with 70 additions and 33 deletions

View File

@ -31,8 +31,8 @@ sub index :Path :Args(0) {
$c->stash->{template} = 'index.tt';
$c->stash->{allBuilds} = [$c->model('DB::Builds')->all];
# Get the latest build for each unique job.
# select * from builds as x where timestamp == (select max(timestamp) from builds where name == x.name);
$c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "name", where => "timestamp == (select max(timestamp) from builds where name == me.name)"})];
# select * from builds as x where timestamp == (select max(timestamp) from builds where jobName == x.jobName);
$c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "jobName", where => "timestamp == (select max(timestamp) from builds where jobName == me.jobName)"})];
}
@ -40,7 +40,7 @@ sub job :Local {
my ( $self, $c, $jobName ) = @_;
$c->stash->{template} = 'job.tt';
$c->stash->{jobName} = $jobName;
$c->stash->{builds} = [$c->model('DB::Builds')->search({name => $jobName}, {order_by => "timestamp DESC"})];
$c->stash->{builds} = [$c->model('DB::Builds')->search({jobName => $jobName}, {order_by => "timestamp DESC"})];
}

View File

@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema';
__PACKAGE__->load_classes;
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iW1lrJQVyiDiAYhJBy9/iQ
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Fayli8dtSdcAYhfKSZnJwg
# You can replace this text with custom content, and it will be preserved on regeneration

View File

@ -25,8 +25,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:01Br5qFsV84USpzqnjk7cw
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xXiHLBKW5fHl7ukdYeIsTw
# You can replace this text with custom content, and it will be preserved on regeneration

View File

@ -25,8 +25,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jYe9p4xG2Ujnf6TsfeE7tA
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5SPq4at2/NRvbax49TwfDw
# You can replace this text with custom content, and it will be preserved on regeneration

View File

@ -12,7 +12,7 @@ __PACKAGE__->add_columns(
{ data_type => "integer", is_nullable => 0, size => undef },
"timestamp",
{ data_type => "integer", is_nullable => 0, size => undef },
"name",
"jobname",
{ data_type => "text", is_nullable => 0, size => undef },
"description",
{ data_type => "text", is_nullable => 0, size => undef },
@ -20,23 +20,31 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 0, size => undef },
"outpath",
{ data_type => "text", is_nullable => 0, size => undef },
"iscachedbuild",
{ data_type => "integer", is_nullable => 0, size => undef },
"buildstatus",
{ data_type => "integer", is_nullable => 0, size => undef },
"errormsg",
{ data_type => "text", is_nullable => 0, size => undef },
"starttime",
{ data_type => "integer", is_nullable => 0, size => undef },
"stoptime",
{ data_type => "integer", is_nullable => 0, size => undef },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->has_many(
"buildlogs",
"HydraFrontend::Schema::Buildlogs",
{ "foreign.buildid" => "self.id" },
);
__PACKAGE__->has_many(
"buildproducts",
"HydraFrontend::Schema::Buildproducts",
{ "foreign.buildid" => "self.id" },
);
__PACKAGE__->has_many(
"buildlogs",
"HydraFrontend::Schema::Buildlogs",
{ "foreign.buildid" => "self.id" },
);
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gxVH+2KWcgU41JOl9BbHFA
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gp6ZZpDA2VzgnNE9NX99dA
1;

View File

@ -12,7 +12,7 @@
</tr>
<tr>
<th>Job name:</th>
<td>[% build.name %]</td>
<td>[% build.jobname %]</td>
</tr>
<tr>
<th>Description:</th>
@ -22,6 +22,16 @@
<th>Time added:</th>
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
</tr>
<tr>
<th>Duration (seconds):</th>
<td>
[% IF build.iscachedbuild %]
<em>(cached build)</em>
[% ELSE %]
[% build.stoptime - build.starttime %]
[% END %]
</td>
</tr>
<tr>
<th>Derivation store path:</th>
<td><tt>[% build.drvpath %]</tt></td>

View File

@ -2,6 +2,8 @@
<h1>Job status</h1>
<p>Below are the latest builds for each job.</p>
<table class="tablesorter">
<thead>
<tr><th></th><th>Id</th><th>Job</th><th>Timestamp</th><th>Description</th></tr>

View File

@ -9,7 +9,7 @@
[% END %]
</td>
<td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
<td><a href="[% c.uri_for('/job' build.name) %]"><tt>[% build.name %]</tt></a></td>
<td><a href="[% c.uri_for('/job' build.jobname) %]"><tt>[% build.jobname %]</tt></a></td>
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
<td>[% build.description %]</td>
</tr>