From 9d9bf8b26480b837eb6293906abf4790d547dd4b Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Tue, 10 Aug 2010 06:48:45 +0000 Subject: [PATCH] hydra: make nr of build to keep configurable per jobset --- src/lib/Hydra/Controller/Jobset.pm | 1 + src/lib/Hydra/Schema/CachedGitInputs.pm | 32 ++----------------------- src/lib/Hydra/Schema/Jobsets.pm | 13 ++++++++-- src/root/jobset.tt | 18 +++++++++----- src/script/hydra_update_gc_roots.pl | 4 ++-- src/sql/hydra.sql | 2 +- 6 files changed, 29 insertions(+), 41 deletions(-) diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index c5ecb94e..d6377b45 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -231,6 +231,7 @@ sub updateJobset { , enabled => trim($c->request->params->{enabled}) eq "1" ? 1 : 0 , enableemail => trim($c->request->params->{enableemail}) eq "1" ? 1 : 0 , emailoverride => trim($c->request->params->{emailoverride}) + , keepnr => trim($c->request->params->{keepnr}) }); my %inputNames; diff --git a/src/lib/Hydra/Schema/CachedGitInputs.pm b/src/lib/Hydra/Schema/CachedGitInputs.pm index 68cf893a..6a69a506 100644 --- a/src/lib/Hydra/Schema/CachedGitInputs.pm +++ b/src/lib/Hydra/Schema/CachedGitInputs.pm @@ -40,20 +40,6 @@ __PACKAGE__->table("CachedGitInputs"); is_nullable: 0 size: undef -=head2 timestamp - - data_type: integer - default_value: undef - is_nullable: 0 - size: undef - -=head2 lastseen - - data_type: integer - default_value: undef - is_nullable: 0 - size: undef - =head2 sha256hash data_type: text @@ -92,20 +78,6 @@ __PACKAGE__->add_columns( is_nullable => 0, size => undef, }, - "timestamp", - { - data_type => "integer", - default_value => undef, - is_nullable => 0, - size => undef, - }, - "lastseen", - { - data_type => "integer", - default_value => undef, - is_nullable => 0, - size => undef, - }, "sha256hash", { data_type => "text", @@ -124,7 +96,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "branch", "revision"); -# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CoeyzZHUEPo7/VpIpLD+Pw +# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-08-10 08:24:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4eYbLtiy5X3yegndBRFtSg 1; diff --git a/src/lib/Hydra/Schema/Jobsets.pm b/src/lib/Hydra/Schema/Jobsets.pm index 97570710..ac498e49 100644 --- a/src/lib/Hydra/Schema/Jobsets.pm +++ b/src/lib/Hydra/Schema/Jobsets.pm @@ -106,6 +106,13 @@ __PACKAGE__->table("Jobsets"); is_nullable: 0 size: undef +=head2 keepnr + + data_type: integer + default_value: 3 + is_nullable: 0 + size: undef + =cut __PACKAGE__->add_columns( @@ -181,6 +188,8 @@ __PACKAGE__->add_columns( is_nullable => 0, size => undef, }, + "keepnr", + { data_type => "integer", default_value => 3, is_nullable => 0, size => undef }, ); __PACKAGE__->set_primary_key("project", "name"); @@ -280,7 +289,7 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-06-04 16:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aQ+7TLIXnNDjjulPNqLq7A +# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-08-10 08:24:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:b/GSJQxUcjCP4fn3peJVMg 1; diff --git a/src/root/jobset.tt b/src/root/jobset.tt index 12c10466..95109058 100644 --- a/src/root/jobset.tt +++ b/src/root/jobset.tt @@ -189,12 +189,18 @@ [% INCLUDE renderSelection param="enableemail" curValue=jobset.enableemail options={"1" = "Yes", "0" = "No"} %] - - Email override: - - [% INCLUDE maybeEditString param="emailoverride" value=jobset.emailoverride %] - - + + Email override: + + [% INCLUDE maybeEditString param="emailoverride" value=jobset.emailoverride %] + + + + Number of builds to keep: + + [% INCLUDE maybeEditString param="keepnr" value=jobset.keepnr %] + + [% IF !edit %] Last checked: diff --git a/src/script/hydra_update_gc_roots.pl b/src/script/hydra_update_gc_roots.pl index 509ca65a..a07a5823 100755 --- a/src/script/hydra_update_gc_roots.pl +++ b/src/script/hydra_update_gc_roots.pl @@ -47,7 +47,7 @@ foreach my $project ($db->resultset('Projects')->search({hidden => 0},{})) { # !!! Take time into account? E.g. don't delete builds that # are younger than N days. my @systems = $job->builds->search({ }, { select => ["system"], distinct => 1 })->all; - + my $keepnr = $job->jobset->keepnr ; foreach my $system (@systems) { my @recentBuilds = $job->builds->search( { finished => 1 @@ -56,7 +56,7 @@ foreach my $project ($db->resultset('Projects')->search({hidden => 0},{})) { }, { join => 'resultInfo' , order_by => 'id DESC' - , rows => 3 # !!! should make this configurable + , rows => $keepnr }); keepBuild $_ foreach @recentBuilds; } diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index e08040ff..4e0fa43e 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -51,6 +51,7 @@ create table Jobsets ( enableEmail integer not null default 1, hidden integer not null default 0, emailOverride text not null, + keepnr integer not null default 3, primary key (project, name), foreign key (project) references Projects(name) on delete cascade on update cascade #ifdef SQLITE @@ -504,7 +505,6 @@ create index IndexBuildsOnTimestamp on Builds(timestamp); create index IndexBuildsOnJobFinishedId on builds(project, jobset, job, system, finished, id DESC); create index IndexCachedHgInputsOnHash on CachedHgInputs(uri, branch, sha256hash); create index IndexCachedGitInputsOnHash on CachedGitInputs(uri, branch, sha256hash); -create index IndexCachedGitInputsOnLastSeen on CachedGitInputs(uri, branch, lastSeen); create index IndexCachedSubversionInputsOnUriRevision on CachedSubversionInputs(uri, revision); create index IndexJobsetEvalMembersOnBuild on JobsetEvalMembers(build); create index IndexJobsetInputAltsOnInput on JobsetInputAlts(project, jobset, input);