Materialize the number of finished builds
[?]
Aug 12, 2013, 6:11 PM
FANTYCR7X2TYLJKGO3E5CU4PVXPSOMQZELEFQCZ6E7GEJOPYXQUACDependencies
- [2]
AVOPQAF7* Make the "all" page faster by not doing four identical `select - [3]
PT5XCF2NAdd another index to speed up the jobstatus page - [4]
32MXC7NNhydra-init: show SQL commands being executed - [5]
S5NPXZG3Fix indentation - [6]
4HPT4SDDRevert "Remove now-unused SystemTypes table" - [7]
3XM2QEGWFix query-all-tables test count, there are more tables now - [8]
AK66K4KYFix the test - [9]
JD7AWXQGRemove now-unused SystemTypes table - [10]
AMFMXR52Provide a command ‘hydra-init’ to initialise/upgrade the database - [11]
YDW2NUIWFix "make check" - [12]
E7FID72SRemove the BuildMachines and BuildMachinesSystemTypes tables - [13]
FPK5LF53* Put the project-related actions in a separate controller. Put the - [14]
D6EL7KR6Fix broken test - [15]
P43FHUUVthere are 43 tests - [16]
DES4PSRLadd basic query tests for JobStatus/LatestSucceeded/ActiveJobs - [17]
QL55ECJ6- adapted ui for hydra, more in line with nixos.org website - [18]
5L272QSCSpeed up the /jobset overview pages a lot - [19]
2I2ZX6JB* Make the "latest succeeded" query (used by the "latest" channel) - [20]
E2TOU3L6* More indices. - [21]
6QRHXIM3* Speed up the jobset index page. Especially the query to get the - [22]
G2ZB6464first test, not yet in buildprocess - [23]
5SMQ2PLKFix tests - [24]
P5VJCT6Ufix wrong comment - [25]
U4TD3AIQAdd support for viewing jobset evaluations - [*]
J5UVLXOK* Start of a basic Catalyst web interface. - [*]
AKAZKCR6* At top-level and for each project, provide two channels: "latest" - [*]
QNYIOH25* Generate a robots.txt. - [*]
D5QIOJGP* Move everything up one directory. - [*]
N22GPKYT* Put info about logs / build products in the DB. - [*]
ZWCTAZGLadded newsitems, added some admin options to clear various caches. - [*]
SMCOU72Fhydra: add some admin for adding/enabling/etc build machines - [*]
4MBKR4XMGratuitous whitespace.
Change contents
- edit in src/lib/Hydra/Base/Controller/ListBuilds.pm at line 58
my $nrBuilds = $c->stash->{allBuilds}->search({finished => 1})->count; - replacement in src/lib/Hydra/Base/Controller/ListBuilds.pm at line 63
$c->stash->{total} = $nrBuilds;$c->stash->{total} = $c->stash->{allBuilds}->search({finished => 1})->countunless defined $c->stash->{total}; - edit in src/lib/Hydra/Controller/Root.pm at line 158
$c->stash->{total} = $c->model('DB::NrBuilds')->find('finished')->count; - file addition: NrBuilds.pm[30.477]
use utf8;package Hydra::Schema::NrBuilds;# Created by DBIx::Class::Schema::Loader# DO NOT MODIFY THE FIRST PART OF THIS FILE=head1 NAMEHydra::Schema::NrBuilds=cutuse strict;use warnings;use base 'DBIx::Class::Core';=head1 COMPONENTS LOADED=over 4=item * L<Hydra::Component::ToJSON>=back=cut__PACKAGE__->load_components("+Hydra::Component::ToJSON");=head1 TABLE: C<NrBuilds>=cut__PACKAGE__->table("NrBuilds");=head1 ACCESSORS=head2 whatdata_type: 'text'is_nullable: 0=head2 countdata_type: 'integer'is_nullable: 0=cut__PACKAGE__->add_columns("what",{ data_type => "text", is_nullable => 0 },"count",{ data_type => "integer", is_nullable => 0 },);=head1 PRIMARY KEY=over 4=item * L</what>=back=cut__PACKAGE__->set_primary_key("what");# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-08-12 17:59:18# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CK8eJGC803nGj0wnete9xg# You can replace this text with custom code or comments, and it will be preserved on regeneration1; - replacement in src/script/hydra-init at line 54
sub run {sub run_ { - replacement in src/script/hydra-init at line 59
run($_) foreach @statements;run_($_) foreach @statements; - edit in src/sql/hydra.sql at line 514
);-- Cache of the number of finished builds.create table NrBuilds (what text primary key not null,count integer not null - edit in src/sql/hydra.sql at line 522[33.12398][34.4]
insert into NrBuilds(what, count) values('finished', 0);#ifdef POSTGRESQLcreate function modifyNrBuildsFinished() returns trigger as $$beginif ((tg_op = 'INSERT' and new.finished = 1) or(tg_op = 'UPDATE' and old.finished = 0 and new.finished = 1)) thenupdate NrBuilds set count = count + 1 where what = 'finished';elsif ((tg_op = 'DELETE' and old.finished = 1) or(tg_op = 'UPDATE' and old.finished = 1 and new.finished = 0)) thenupdate NrBuilds set count = count - 1 where what = 'finished';end if;return null;end;$$ language plpgsql;create trigger NrBuildsFinished after insert or update or delete on Buildsfor each rowexecute procedure modifyNrBuildsFinished();#endif - replacement in src/sql/hydra.sql at line 567
create index IndexBuildsOnJobsetFinishedTimestamp on Builds(project, jobset, finished, timestamp DESC);create index IndexBuildsOnJobsetFinishedTimestamp on Builds(project, jobset, finished, timestamp DESC); -- obsolete? - file addition: upgrade-17.sql[30.3004]
create table NrBuilds (what text primary key not null,count integer not null);create function modifyNrBuildsFinished() returns trigger as $$beginif ((tg_op = 'INSERT' and new.finished = 1) or(tg_op = 'UPDATE' and old.finished = 0 and new.finished = 1)) thenupdate NrBuilds set count = count + 1 where what = 'finished';elsif ((tg_op = 'DELETE' and old.finished = 1) or(tg_op = 'UPDATE' and old.finished = 1 and new.finished = 0)) thenupdate NrBuilds set count = count - 1 where what = 'finished';end if;return null;end;$$ language plpgsql;create trigger NrBuildsFinished after insert or update or delete on Buildsfor each rowexecute procedure modifyNrBuildsFinished();insert into NrBuilds(what, count) select 'finished', count(*) from Builds where finished = 1; - replacement in tests/query-all-tables.pl at line 10
use Test::Simple tests => 43;use Test::Simple tests => 44; - replacement in tests/query-all-tables.pl at line 14
if ($source eq "SchemaVersion") {if ($source eq "SchemaVersion" || $source eq "NrBuilds") {