From 1776d9118f9422915557d01c0ecb888a2adc8342 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Aug 2013 02:33:10 +0200 Subject: [PATCH] Rename aggregate members to constituents --- src/c/hydra-eval-jobs.cc | 8 ++-- ...ateMembers.pm => AggregateConstituents.pm} | 26 ++++++------ src/lib/Hydra/Schema/Builds.pm | 42 +++++++++++-------- src/root/build.tt | 24 +++++------ src/script/hydra-evaluator | 14 +++---- src/sql/hydra.sql | 6 +-- src/sql/upgrade-19.sql | 6 +-- 7 files changed, 67 insertions(+), 59 deletions(-) rename src/lib/Hydra/Schema/{AggregateMembers.pm => AggregateConstituents.pm} (72%) diff --git a/src/c/hydra-eval-jobs.cc b/src/c/hydra-eval-jobs.cc index ca2fb7fb..7680a6d3 100644 --- a/src/c/hydra-eval-jobs.cc +++ b/src/c/hydra-eval-jobs.cc @@ -160,12 +160,12 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc, } xmlAttrs["maintainers"] = maintainers; - /* If this is an aggregate, then get its members. */ + /* If this is an aggregate, then get its constituents. */ Bindings::iterator a = v.attrs->find(state.symbols.create("_hydraAggregate")); if (a != v.attrs->end() && state.forceBool(*a->value)) { - Bindings::iterator a = v.attrs->find(state.symbols.create("members")); + Bindings::iterator a = v.attrs->find(state.symbols.create("constituents")); if (a == v.attrs->end()) - throw EvalError("derivation must have a ‘members’ attribute"); + throw EvalError("derivation must have a ‘constituents’ attribute"); PathSet context; state.coerceToString(*a->value, context, true, false); PathSet drvs; @@ -174,7 +174,7 @@ static void findJobsWrapped(EvalState & state, XMLWriter & doc, size_t index = i->find("!", 1); drvs.insert(string(*i, index + 1)); } - xmlAttrs["members"] = concatStringsSep(" ", drvs); + xmlAttrs["constituents"] = concatStringsSep(" ", drvs); } /* Register the derivation as a GC root. !!! This diff --git a/src/lib/Hydra/Schema/AggregateMembers.pm b/src/lib/Hydra/Schema/AggregateConstituents.pm similarity index 72% rename from src/lib/Hydra/Schema/AggregateMembers.pm rename to src/lib/Hydra/Schema/AggregateConstituents.pm index 4a037663..8112a49c 100644 --- a/src/lib/Hydra/Schema/AggregateMembers.pm +++ b/src/lib/Hydra/Schema/AggregateConstituents.pm @@ -1,12 +1,12 @@ use utf8; -package Hydra::Schema::AggregateMembers; +package Hydra::Schema::AggregateConstituents; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE =head1 NAME -Hydra::Schema::AggregateMembers +Hydra::Schema::AggregateConstituents =cut @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("AggregateMembers"); +__PACKAGE__->table("AggregateConstituents"); =head1 ACCESSORS @@ -41,7 +41,7 @@ __PACKAGE__->table("AggregateMembers"); is_foreign_key: 1 is_nullable: 0 -=head2 member +=head2 constituent data_type: 'integer' is_foreign_key: 1 @@ -52,7 +52,7 @@ __PACKAGE__->table("AggregateMembers"); __PACKAGE__->add_columns( "aggregate", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, - "member", + "constituent", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, ); @@ -62,13 +62,13 @@ __PACKAGE__->add_columns( =item * L -=item * L +=item * L =back =cut -__PACKAGE__->set_primary_key("aggregate", "member"); +__PACKAGE__->set_primary_key("aggregate", "constituent"); =head1 RELATIONS @@ -87,7 +87,7 @@ __PACKAGE__->belongs_to( { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, ); -=head2 member +=head2 constituent Type: belongs_to @@ -96,15 +96,15 @@ Related object: L =cut __PACKAGE__->belongs_to( - "member", + "constituent", "Hydra::Schema::Builds", - { id => "member" }, + { id => "constituent" }, { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-08-13 22:17:52 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jHJtO2baXiprv0OcWCLZ+w +# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-08-15 00:20:01 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TLNenyPLIWw2gWsOVhplZw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 2bf821b6..f67fabda 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -288,33 +288,33 @@ __PACKAGE__->set_primary_key("id"); =head1 RELATIONS -=head2 aggregatemembers_aggregates +=head2 aggregateconstituents_aggregates Type: has_many -Related object: L +Related object: L =cut __PACKAGE__->has_many( - "aggregatemembers_aggregates", - "Hydra::Schema::AggregateMembers", + "aggregateconstituents_aggregates", + "Hydra::Schema::AggregateConstituents", { "foreign.aggregate" => "self.id" }, undef, ); -=head2 aggregatemembers_members +=head2 aggregateconstituents_constituents Type: has_many -Related object: L +Related object: L =cut __PACKAGE__->has_many( - "aggregatemembers_members", - "Hydra::Schema::AggregateMembers", - { "foreign.member" => "self.id" }, + "aggregateconstituents_constituents", + "Hydra::Schema::AggregateConstituents", + { "foreign.constituent" => "self.id" }, undef, ); @@ -502,25 +502,33 @@ __PACKAGE__->has_many( Type: many_to_many -Composing rels: L -> aggregate +Composing rels: L -> aggregate =cut -__PACKAGE__->many_to_many("aggregates", "aggregatemembers_members", "aggregate"); +__PACKAGE__->many_to_many( + "aggregates", + "aggregateconstituents_constituents", + "aggregate", +); -=head2 members +=head2 constituents Type: many_to_many -Composing rels: L -> member +Composing rels: L -> constituent =cut -__PACKAGE__->many_to_many("members", "aggregatemembers_members", "member"); +__PACKAGE__->many_to_many( + "constituents", + "aggregateconstituents_constituents", + "constituent", +); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-08-13 22:17:52 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9jqsol/evbHYjusT09hLtw +# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-08-15 00:20:01 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:U1j/qm0vslb6Jvgu5mGMtw __PACKAGE__->has_many( "dependents", @@ -552,7 +560,7 @@ __PACKAGE__->has_many( __PACKAGE__->many_to_many("jobsetevals", "jobsetevalmembers", "eval"); -__PACKAGE__->many_to_many("members_", "aggregatemembers_aggregates", "member"); +__PACKAGE__->many_to_many("constituents_", "aggregateconstituents_aggregates", "constituent"); sub makeSource { my ($name, $query) = @_; diff --git a/src/root/build.tt b/src/root/build.tt index cb268b61..73dc0c54 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -7,7 +7,7 @@ [% project = build.project %] [% jobset = build.jobset %] [% job = build.job %] -[% isAggregate = build.members_ ? 1 : 0 %] +[% isAggregate = build.constituents_ ? 1 : 0 %] [% BLOCK renderOutputs %] [% start=1; FOREACH output IN outputs %] @@ -119,21 +119,21 @@ [% INCLUDE renderStatus build=build icon=0 %] [% IF isAggregate; - nrMembers = 0; + nrConstituents = 0; nrFinished = 0; - nrFailedMembers = 0; - FOREACH b IN build.members_; - nrMembers = nrMembers + 1; + nrFailedConstituents = 0; + FOREACH b IN build.constituents_; + nrConstituents = nrConstituents + 1; IF b.finished; nrFinished = nrFinished + 1; END; - IF b.finished && b.buildstatus != 0; nrFailedMembers = nrFailedMembers + 1; END; + IF b.finished && b.buildstatus != 0; nrFailedConstituents = nrFailedConstituents + 1; END; END; %]; - [%+ IF nrFinished == 0 && nrFailedMembers == 0 %] - all [% nrMembers %] constituent builds succeeded + [%+ IF nrFinished == nrMembers && nrFailedConstituents == 0 %] + all [% nrConstituents %] constituent builds succeeded [% ELSE %] - [% nrFailedMembers %] out of [% nrMembers %] constituent builds failed - [% IF nrFinished < nrMembers %] - ([% nrMembers - nrFinished %] still pending) + [% nrFailedConstituents %] out of [% nrConstituents %] constituent builds failed + [% IF nrFinished < nrConstituents %] + ([% nrConstituents - nrFinished %] still pending) [% END %] [% END %] [% END %] @@ -280,7 +280,7 @@

This build is an aggregate of the following builds:

- [% INCLUDE renderBuildList builds=build.members_ %] + [% INCLUDE renderBuildList builds=build.constituents_ %] diff --git a/src/script/hydra-evaluator b/src/script/hydra-evaluator index a6dfde46..0fdca76a 100755 --- a/src/script/hydra-evaluator +++ b/src/script/hydra-evaluator @@ -183,16 +183,16 @@ sub checkJobsetWrapped { $drvPathToId{$x->{drvPath}} = $id; } - # Create AggregateMembers mappings. + # Create AggregateConstituents mappings. foreach my $job (@{$jobs->{job}}) { - next unless $job->{members}; + next unless $job->{constituents}; my $id = $drvPathToId{$job->{drvPath}} or die; - foreach my $drvPath (split / /, $job->{members}) { - my $member = $drvPathToId{$drvPath}; - if (defined $member) { - $db->resultset('AggregateMembers')->update_or_create({aggregate => $id, member => $member}); + foreach my $drvPath (split / /, $job->{constituents}) { + my $constituent = $drvPathToId{$drvPath}; + if (defined $constituent) { + $db->resultset('AggregateConstituents')->update_or_create({aggregate => $id, constituent => $constituent}); } else { - warn "aggregate job ‘$job->{jobName}’ has a member ‘$drvPath’ that doesn't correspond to a Hydra build\n"; + warn "aggregate job ‘$job->{jobName}’ has a constituent ‘$drvPath’ that doesn't correspond to a Hydra build\n"; } } } diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index ee601c62..7bbd26b3 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -514,10 +514,10 @@ create table NewsItems ( ); -create table AggregateMembers ( +create table AggregateConstituents ( aggregate integer not null references Builds(id) on delete cascade, - member integer not null references Builds(id) on delete cascade, - primary key (aggregate, member) + constituent integer not null references Builds(id) on delete cascade, + primary key (aggregate, constituent) ); diff --git a/src/sql/upgrade-19.sql b/src/sql/upgrade-19.sql index 3d1e849b..72462d62 100644 --- a/src/sql/upgrade-19.sql +++ b/src/sql/upgrade-19.sql @@ -1,5 +1,5 @@ -create table AggregateMembers ( +create table AggregateConstituents ( aggregate integer not null references Builds(id) on delete cascade, - member integer not null references Builds(id) on delete cascade, - primary key (aggregate, member) + constituent integer not null references Builds(id) on delete cascade, + primary key (aggregate, constituent) );