Author: eelco
Date: Tue Aug 31 15:27:46 2010
New Revision: 23566
URL: https://svn.nixos.org/websvn/nix/?rev=23566&sc=1
Log:
* Added a status page that shows all the currently executing build steps.
* Store the system type in the BuildSteps table.
* Don't query the queue size when serving static pages. This prevents
two unnecessary database queries per request.
Added:
hydra/trunk/src/root/status.tt
Modified:
hydra/trunk/src/lib/Hydra/Controller/Build.pm
hydra/trunk/src/lib/Hydra/Controller/Root.pm
hydra/trunk/src/lib/Hydra/Schema/BuildSteps.pm
hydra/trunk/src/root/static/css/hydra.css
hydra/trunk/src/script/hydra_build.pl
hydra/trunk/src/sql/hydra.sql
Modified: hydra/trunk/src/lib/Hydra/Controller/Build.pm
==============================================================================
--- hydra/trunk/src/lib/Hydra/Controller/Build.pm Tue Aug 31 14:20:44
2010 (r23565)
+++ hydra/trunk/src/lib/Hydra/Controller/Build.pm Tue Aug 31 15:27:46
2010 (r23566)
@@ -35,7 +35,6 @@
my $build = $c->stash->{build};
$c->stash->{template} = 'build.tt';
- $c->stash->{curTime} = time;
$c->stash->{available} = isValidPath $build->outpath;
$c->stash->{drvAvailable} = isValidPath $build->drvpath;
$c->stash->{flashMsg} = $c->flash->{buildMsg};
Modified: hydra/trunk/src/lib/Hydra/Controller/Root.pm
==============================================================================
--- hydra/trunk/src/lib/Hydra/Controller/Root.pm Tue Aug 31 14:20:44
2010 (r23565)
+++ hydra/trunk/src/lib/Hydra/Controller/Root.pm Tue Aug 31 15:27:46
2010 (r23566)
@@ -12,14 +12,16 @@
sub begin :Private {
- my ($self, $c) = @_;
+ my ($self, $c, @args) = @_;
$c->stash->{curUri} = $c->request->uri;
$c->stash->{version} = $ENV{"HYDRA_RELEASE"} || "<devel>";
- $c->stash->{nixVersion} = $ENV{"NIX_RELEASE"} || "<devel>";
-
- $c->stash->{nrRunningBuilds} =
$c->model('DB::BuildSchedulingInfo')->search({ busy => 1 }, {})->count();
- $c->stash->{nrQueuedBuilds} =
$c->model('DB::BuildSchedulingInfo')->count();
-
+ $c->stash->{nixVersion} = $ENV{"NIX_RELEASE"} || "<devel>";
+ $c->stash->{curTime} = time;
+
+ if (scalar(@args) && $args[0] ne "static") {
+ $c->stash->{nrRunningBuilds} =
$c->model('DB::BuildSchedulingInfo')->search({ busy => 1 }, {})->count();
+ $c->stash->{nrQueuedBuilds} =
$c->model('DB::BuildSchedulingInfo')->count();
+ }
}
@@ -74,6 +76,7 @@
$c->stash->{flashMsg} = $c->flash->{buildMsg};
}
+
sub timeline :Local {
my ($self, $c) = @_;
my $pit = time();
@@ -90,6 +93,17 @@
})];
}
+
+sub status :Local {
+ my ($self, $c) = @_;
+ $c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
+ { 'me.busy' => 1, 'schedulingInfo.busy' => 1 },
+ { join => [ 'schedulingInfo' ]
+ , order_by => [ 'machine', 'outpath' ]
+ } ) ];
+}
+
+
# Hydra::Base::Controller::ListBuilds needs this.
sub get_builds : Chained('/') PathPart('') CaptureArgs(0) {
my ($self, $c) = @_;
Modified: hydra/trunk/src/lib/Hydra/Schema/BuildSteps.pm
==============================================================================
--- hydra/trunk/src/lib/Hydra/Schema/BuildSteps.pm Tue Aug 31 14:20:44
2010 (r23565)
+++ hydra/trunk/src/lib/Hydra/Schema/BuildSteps.pm Tue Aug 31 15:27:46
2010 (r23566)
@@ -104,6 +104,13 @@
is_nullable: 0
size: undef
+=head2 system
+
+ data_type: text
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
=cut
__PACKAGE__->add_columns(
@@ -187,6 +194,13 @@
},
"machine",
{ data_type => "text", default_value => "''", is_nullable => 0, size =>
undef },
+ "system",
+ {
+ data_type => "text",
+ default_value => undef,
+ is_nullable => 1,
+ size => undef,
+ },
);
__PACKAGE__->set_primary_key("build", "stepnr");
@@ -203,7 +217,13 @@
__PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" },
{});
-# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-08-31 15:40:29
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CC/XBHMiRLuQSI+nEFW50g
+# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-08-31 17:19:01
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BU1na1One0SzUwilm7YmQQ
+
+__PACKAGE__->belongs_to(
+ "schedulingInfo",
+ "Hydra::Schema::BuildSchedulingInfo",
+ { id => "build" },
+);
1;
Modified: hydra/trunk/src/root/static/css/hydra.css
==============================================================================
--- hydra/trunk/src/root/static/css/hydra.css Tue Aug 31 14:20:44 2010
(r23565)
+++ hydra/trunk/src/root/static/css/hydra.css Tue Aug 31 15:27:46 2010
(r23566)
@@ -53,10 +53,15 @@
background-color: #E6EEFF;
cursor: pointer;
}
+
td.centered {
text-align: center;
}
+td.right {
+ text-align: right;
+}
+
.layoutTable td, .layoutTable th {
border-style: none;
Added: hydra/trunk/src/root/status.tt
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ hydra/trunk/src/root/status.tt Tue Aug 31 15:27:46 2010 (r23566)
@@ -0,0 +1,24 @@
+[% WRAPPER layout.tt title="Hydra status" %]
+[% PROCESS common.tt %]
+
+<h1>Hydra Status</h1>
+
+<table class="tablesorter">
+ <thead>
+
<tr><th>Machine</th><th>Type</th><th>Build</th><th>Step</th><th>What</th><th>Since</th></tr>
+ </thead>
+ <tbody>
+ [% FOREACH step IN steps %]
+ <tr>
+ <td><tt>[% IF step.machine; step.machine.match('@(.*)').0; ELSE;
'localhost'; END %]</tt></td>
+ <td><tt>[% step.system %]</tt></td>
+ <td><a href="[% c.uri_for('/build' step.build.id) %]">[% step.build.id
%]</a></td>
+ <td><a href="[% c.uri_for('/build' step.build.id 'nixlog' step.stepnr)
%]">[% step.stepnr %]</a></td>
+ <td><tt>[% step.outpath.match('-(.*)').0 %]</tt></td>
+ <td class='right'>[% INCLUDE renderDuration duration = curTime -
step.starttime %] </td>
+ </tr>
+ [% END %]
+ </tbody>
+</table>
+
+[% END %]
Modified: hydra/trunk/src/script/hydra_build.pl
==============================================================================
--- hydra/trunk/src/script/hydra_build.pl Tue Aug 31 14:20:44 2010
(r23565)
+++ hydra/trunk/src/script/hydra_build.pl Tue Aug 31 15:27:46 2010
(r23566)
@@ -264,6 +264,7 @@
, type => 0 # = build
, drvpath => $drvPathStep
, outpath => $2
+ , system => $3
, logfile => $4
, busy => 1
, starttime => time
Modified: hydra/trunk/src/sql/hydra.sql
==============================================================================
--- hydra/trunk/src/sql/hydra.sql Tue Aug 31 14:20:44 2010 (r23565)
+++ hydra/trunk/src/sql/hydra.sql Tue Aug 31 15:27:46 2010 (r23566)
@@ -236,6 +236,7 @@
stopTime integer,
machine text not null default '',
+ system text,
primary key (build, stepnr),
foreign key (build) references Builds(id) on delete cascade
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits