Rename aggregate members to constituents

This commit is contained in:
Eelco Dolstra 2013-08-15 02:33:10 +02:00
parent e4141afcc9
commit 1776d9118f
7 changed files with 67 additions and 59 deletions

View file

@ -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

View file

@ -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<AggregateMembers>
=head1 TABLE: C<AggregateConstituents>
=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</aggregate>
=item * L</member>
=item * L</constituent>
=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<Hydra::Schema::Builds>
=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

View file

@ -288,33 +288,33 @@ __PACKAGE__->set_primary_key("id");
=head1 RELATIONS
=head2 aggregatemembers_aggregates
=head2 aggregateconstituents_aggregates
Type: has_many
Related object: L<Hydra::Schema::AggregateMembers>
Related object: L<Hydra::Schema::AggregateConstituents>
=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<Hydra::Schema::AggregateMembers>
Related object: L<Hydra::Schema::AggregateConstituents>
=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</aggregatemembers_members> -> aggregate
Composing rels: L</aggregateconstituents_constituents> -> 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</aggregatemembers_members> -> member
Composing rels: L</aggregateconstituents_constituents> -> 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) = @_;

View file

@ -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 @@
<td>
[% 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 @@
<p>This build is an aggregate of the following builds:</p>
[% INCLUDE renderBuildList builds=build.members_ %]
[% INCLUDE renderBuildList builds=build.constituents_ %]
</div>

View file

@ -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";
}
}
}

View file

@ -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)
);

View file

@ -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)
);