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];
# Get stats for this eval.
my $nrBuilds = $cur->jobsetevalmembers->count;
my $nrScheduled = $cur->builds->search({finished => 0})->count;
my $nrSucceeded = $cur->builds->search({finished => 1, buildStatus => 0})->count;
my $nrScheduled;
my $nrSucceeded = $cur->nrsucceeded;
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.
my $curInputs = [ $cur->jobsetevalinputs->search(
@ -359,10 +367,9 @@ sub getEvals {
my $e =
{ eval => $cur
, nrBuilds => $nrBuilds
, nrScheduled => $nrScheduled
, nrSucceeded => $nrSucceeded
, nrFailed => $nrBuilds - $nrSucceeded - $nrScheduled
, nrFailed => $cur->nrbuilds - $nrSucceeded - $nrScheduled
, diff => defined $prev ? $nrSucceeded - $prev->{nrSucceeded} : 0
, changedInputs => [ @changedInputs ]
};

View file

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

View file

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

View file

@ -438,6 +438,10 @@ create table JobsetEvals (
-- over the command-line arguments to hydra-eval-jobs.
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, jobset) references Jobsets(project, name) on delete cascade on update cascade
);