Missing part of aaacf9eda3

This commit is contained in:
Eelco Dolstra 2012-04-15 22:57:10 +00:00
parent 0446282a63
commit ec87ad2bf2
4 changed files with 33 additions and 7 deletions

View file

@ -339,9 +339,17 @@ sub getEvals {
my $cur = $evals[$n]; my $cur = $evals[$n];
# Get stats for this eval. # Get stats for this eval.
my $nrBuilds = $cur->jobsetevalmembers->count; my $nrScheduled;
my $nrScheduled = $cur->builds->search({finished => 0})->count; my $nrSucceeded = $cur->nrsucceeded;
my $nrSucceeded = $cur->builds->search({finished => 1, buildStatus => 0})->count; if (defined $nrSucceeded) {
$nrScheduled = 0;
} else {
$nrScheduled = $cur->builds->search({finished => 0})->count;
$nrSucceeded = $cur->builds->search({finished => 1, buildStatus => 0})->count;
if ($nrScheduled == 0) {
$cur->update({nrsucceeded => $nrSucceeded});
}
}
# Compute what inputs changed between each eval. # Compute what inputs changed between each eval.
my $curInputs = [ $cur->jobsetevalinputs->search( my $curInputs = [ $cur->jobsetevalinputs->search(
@ -359,10 +367,9 @@ sub getEvals {
my $e = my $e =
{ eval => $cur { eval => $cur
, nrBuilds => $nrBuilds
, nrScheduled => $nrScheduled , nrScheduled => $nrScheduled
, nrSucceeded => $nrSucceeded , nrSucceeded => $nrSucceeded
, nrFailed => $nrBuilds - $nrSucceeded - $nrScheduled , nrFailed => $cur->nrbuilds - $nrSucceeded - $nrScheduled
, diff => defined $prev ? $nrSucceeded - $prev->{nrSucceeded} : 0 , diff => defined $prev ? $nrSucceeded - $prev->{nrSucceeded} : 0
, changedInputs => [ @changedInputs ] , changedInputs => [ @changedInputs ]
}; };

View file

@ -66,6 +66,16 @@ __PACKAGE__->table("JobsetEvals");
data_type: 'text' data_type: 'text'
is_nullable: 0 is_nullable: 0
=head2 nrbuilds
data_type: 'integer'
is_nullable: 1
=head2 nrsucceeded
data_type: 'integer'
is_nullable: 1
=cut =cut
__PACKAGE__->add_columns( __PACKAGE__->add_columns(
@ -85,6 +95,10 @@ __PACKAGE__->add_columns(
{ data_type => "integer", is_nullable => 0 }, { data_type => "integer", is_nullable => 0 },
"hash", "hash",
{ data_type => "text", is_nullable => 0 }, { data_type => "text", is_nullable => 0 },
"nrbuilds",
{ data_type => "integer", is_nullable => 1 },
"nrsucceeded",
{ data_type => "integer", is_nullable => 1 },
); );
=head1 PRIMARY KEY =head1 PRIMARY KEY
@ -157,8 +171,8 @@ Related object: L<Hydra::Schema::Projects>
__PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" }, {}); __PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" }, {});
# Created by DBIx::Class::Schema::Loader v0.07014 @ 2012-04-15 16:38:10 # Created by DBIx::Class::Schema::Loader v0.07014 @ 2012-04-15 22:30:41
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Yt39QbkhH52hfpJZ4ZECeg # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jn81MbsAb5KZGwRpQ7qTEQ
__PACKAGE__->has_many( __PACKAGE__->has_many(
"buildIds", "buildIds",

View file

@ -165,6 +165,7 @@ sub checkJobset {
, checkouttime => abs($checkoutStop - $checkoutStart) , checkouttime => abs($checkoutStop - $checkoutStart)
, evaltime => abs($evalStop - $evalStart) , evaltime => abs($evalStop - $evalStart)
, hasnewbuilds => $hasNewBuilds , hasnewbuilds => $hasNewBuilds
, nrbuilds => $hasNewBuilds ? scalar(keys %buildIds) : undef
}); });
if ($hasNewBuilds) { if ($hasNewBuilds) {

View file

@ -438,6 +438,10 @@ create table JobsetEvals (
-- over the command-line arguments to hydra-eval-jobs. -- over the command-line arguments to hydra-eval-jobs.
hash text not null, hash text not null,
-- Cached stats about the builds.
nrBuilds integer,
nrSucceeded integer, -- set lazily when all builds are finished
foreign key (project) references Projects(name) on delete cascade on update cascade, foreign key (project) references Projects(name) on delete cascade on update cascade,
foreign key (project, jobset) references Jobsets(project, name) on delete cascade on update cascade foreign key (project, jobset) references Jobsets(project, name) on delete cascade on update cascade
); );