* Store jobset evaluations in the database explicitly. This includes

recording the builds that are part of a jobset evaluation.  We need
  this to be able to answer queries such as "return the latest NixOS
  ISO for which the installation test succeeded".  This wasn't previously
  possible because the database didn't record which builds of (say)
  the `isoMinimal' job and the `tests.installer.simple' job came from
  the same evaluation of the nixos:trunk jobset.

  Keeping a record of evaluations is also useful for logging purposes.
This commit is contained in:
Eelco Dolstra
2010-03-05 15:41:10 +00:00
parent 60ad8bd6d1
commit 7daca03e78
11 changed files with 415 additions and 161 deletions

View File

@ -74,7 +74,7 @@ sub fetchInputPath {
# Some simple caching: don't check a path more than once every N seconds.
(my $cachedInput) = $db->resultset('CachedPathInputs')->search(
{srcpath => $uri, lastseen => {">", $timestamp - 60}},
{srcpath => $uri, lastseen => {">", $timestamp - 30}},
{rows => 1, order_by => "lastseen DESC"});
if (defined $cachedInput && isValidPath($cachedInput->storepath)) {
@ -505,7 +505,7 @@ sub checkBuild {
my @previousBuilds = $job->builds->search({outPath => $outPath, isCurrent => 1});
if (scalar(@previousBuilds) > 0) {
print STDERR "already scheduled/built\n";
$currentBuilds->{$_->id} = 1 foreach @previousBuilds;
$currentBuilds->{$_->id} = 0 foreach @previousBuilds;
return;
}

View File

@ -44,7 +44,7 @@ __PACKAGE__->table("BuildSchedulingInfo");
=head2 locker
data_type: text
default_value: (empty string)
default_value: ''
is_nullable: 0
size: undef
@ -85,7 +85,7 @@ __PACKAGE__->add_columns(
"busy",
{ data_type => "integer", default_value => 0, is_nullable => 0, size => undef },
"locker",
{ data_type => "text", default_value => "", is_nullable => 0, size => undef },
{ data_type => "text", default_value => "''", is_nullable => 0, size => undef },
"logfile",
{
data_type => "text",
@ -118,8 +118,8 @@ Related object: L<Hydra::Schema::Builds>
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }, {});
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yEhHeANRynKf72dp5URvZA
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-03-05 13:07:46
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qOU/YGv3fgPynBXovV6gfg
# You can replace this text with custom content, and it will be preserved on regeneration
1;

View File

@ -420,9 +420,23 @@ __PACKAGE__->has_many(
{ "foreign.build" => "self.id" },
);
=head2 jobsetevalmembers
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 11:19:24
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oCkX9bughWPZg6JKaOxDJA
Type: has_many
Related object: L<Hydra::Schema::JobsetEvalMembers>
=cut
__PACKAGE__->has_many(
"jobsetevalmembers",
"Hydra::Schema::JobsetEvalMembers",
{ "foreign.build" => "self.id" },
);
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-03-05 13:07:46
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sE2/zTcfETC8Eahh6NQDZA
use Hydra::Helper::Nix;

View File

@ -0,0 +1,102 @@
package Hydra::Schema::JobsetEvalMembers;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 NAME
Hydra::Schema::JobsetEvalMembers
=cut
__PACKAGE__->table("JobsetEvalMembers");
=head1 ACCESSORS
=head2 eval
data_type: integer
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 build
data_type: integer
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 isnew
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=cut
__PACKAGE__->add_columns(
"eval",
{
data_type => "integer",
default_value => undef,
is_foreign_key => 1,
is_nullable => 0,
size => undef,
},
"build",
{
data_type => "integer",
default_value => undef,
is_foreign_key => 1,
is_nullable => 0,
size => undef,
},
"isnew",
{
data_type => "integer",
default_value => undef,
is_nullable => 0,
size => undef,
},
);
__PACKAGE__->set_primary_key("eval", "build");
=head1 RELATIONS
=head2 eval
Type: belongs_to
Related object: L<Hydra::Schema::JobsetEvals>
=cut
__PACKAGE__->belongs_to("eval", "Hydra::Schema::JobsetEvals", { id => "eval" }, {});
=head2 build
Type: belongs_to
Related object: L<Hydra::Schema::Builds>
=cut
__PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" }, {});
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-03-05 13:07:46
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vwefi8q3HolhFCkB9aEVWw
# You can replace this text with custom content, and it will be preserved on regeneration
1;

View File

@ -0,0 +1,200 @@
package Hydra::Schema::JobsetEvals;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 NAME
Hydra::Schema::JobsetEvals
=cut
__PACKAGE__->table("JobsetEvals");
=head1 ACCESSORS
=head2 id
data_type: integer
default_value: undef
is_auto_increment: 1
is_nullable: 0
size: undef
=head2 project
data_type: text
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 jobset
data_type: text
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 timestamp
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=head2 checkouttime
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=head2 evaltime
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=head2 hasnewbuilds
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=head2 hash
data_type: text
default_value: undef
is_nullable: 0
size: undef
=cut
__PACKAGE__->add_columns(
"id",
{
data_type => "integer",
default_value => undef,
is_auto_increment => 1,
is_nullable => 0,
size => undef,
},
"project",
{
data_type => "text",
default_value => undef,
is_foreign_key => 1,
is_nullable => 0,
size => undef,
},
"jobset",
{
data_type => "text",
default_value => undef,
is_foreign_key => 1,
is_nullable => 0,
size => undef,
},
"timestamp",
{
data_type => "integer",
default_value => undef,
is_nullable => 0,
size => undef,
},
"checkouttime",
{
data_type => "integer",
default_value => undef,
is_nullable => 0,
size => undef,
},
"evaltime",
{
data_type => "integer",
default_value => undef,
is_nullable => 0,
size => undef,
},
"hasnewbuilds",
{
data_type => "integer",
default_value => undef,
is_nullable => 0,
size => undef,
},
"hash",
{
data_type => "text",
default_value => undef,
is_nullable => 0,
size => undef,
},
);
__PACKAGE__->set_primary_key("id");
=head1 RELATIONS
=head2 project
Type: belongs_to
Related object: L<Hydra::Schema::Projects>
=cut
__PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" }, {});
=head2 jobset
Type: belongs_to
Related object: L<Hydra::Schema::Jobsets>
=cut
__PACKAGE__->belongs_to(
"jobset",
"Hydra::Schema::Jobsets",
{ name => "jobset", project => "project" },
{},
);
=head2 jobsetevalmembers
Type: has_many
Related object: L<Hydra::Schema::JobsetEvalMembers>
=cut
__PACKAGE__->has_many(
"jobsetevalmembers",
"Hydra::Schema::JobsetEvalMembers",
{ "foreign.eval" => "self.id" },
);
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-03-05 13:33:51
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QD7ZMOLp9HpK0mAYkk0d/Q
use Hydra::Helper::Nix;
# !!! Ugly, should be generated.
my $hydradbi = getHydraDBPath;
if ($hydradbi =~ m/^dbi:Pg/) {
__PACKAGE__->sequence('jobsetevals_id_seq');
}
# You can replace this text with custom content, and it will be preserved on regeneration
1;

View File

@ -1,119 +0,0 @@
package Hydra::Schema::JobsetInputHashes;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 NAME
Hydra::Schema::JobsetInputHashes
=cut
__PACKAGE__->table("JobsetInputHashes");
=head1 ACCESSORS
=head2 project
data_type: text
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 jobset
data_type: text
default_value: undef
is_foreign_key: 1
is_nullable: 0
size: undef
=head2 hash
data_type: text
default_value: undef
is_nullable: 0
size: undef
=head2 timestamp
data_type: integer
default_value: undef
is_nullable: 0
size: undef
=cut
__PACKAGE__->add_columns(
"project",
{
data_type => "text",
default_value => undef,
is_foreign_key => 1,
is_nullable => 0,
size => undef,
},
"jobset",
{
data_type => "text",
default_value => undef,
is_foreign_key => 1,
is_nullable => 0,
size => undef,
},
"hash",
{
data_type => "text",
default_value => undef,
is_nullable => 0,
size => undef,
},
"timestamp",
{
data_type => "integer",
default_value => undef,
is_nullable => 0,
size => undef,
},
);
__PACKAGE__->set_primary_key("project", "jobset", "hash");
=head1 RELATIONS
=head2 project
Type: belongs_to
Related object: L<Hydra::Schema::Projects>
=cut
__PACKAGE__->belongs_to("project", "Hydra::Schema::Projects", { name => "project" }, {});
=head2 jobset
Type: belongs_to
Related object: L<Hydra::Schema::Jobsets>
=cut
__PACKAGE__->belongs_to(
"jobset",
"Hydra::Schema::Jobsets",
{ name => "jobset", project => "project" },
{},
);
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dK9vFHXInejDW/rl1i/kFA
1;

View File

@ -253,17 +253,17 @@ __PACKAGE__->has_many(
},
);
=head2 jobsetinputhashes
=head2 jobsetevals
Type: has_many
Related object: L<Hydra::Schema::JobsetInputHashes>
Related object: L<Hydra::Schema::JobsetEvals>
=cut
__PACKAGE__->has_many(
"jobsetinputhashes",
"Hydra::Schema::JobsetInputHashes",
"jobsetevals",
"Hydra::Schema::JobsetEvals",
{
"foreign.jobset" => "self.name",
"foreign.project" => "self.project",
@ -271,7 +271,7 @@ __PACKAGE__->has_many(
);
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ORCZ73BJrscvmyf/4ds0UQ
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-03-05 13:07:46
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Z0HutYxnzYVuQc3W51mq5Q
1;

View File

@ -216,22 +216,22 @@ __PACKAGE__->has_many(
{ "foreign.project" => "self.name" },
);
=head2 jobsetinputhashes
=head2 jobsetevals
Type: has_many
Related object: L<Hydra::Schema::JobsetInputHashes>
Related object: L<Hydra::Schema::JobsetEvals>
=cut
__PACKAGE__->has_many(
"jobsetinputhashes",
"Hydra::Schema::JobsetInputHashes",
"jobsetevals",
"Hydra::Schema::JobsetEvals",
{ "foreign.project" => "self.name" },
);
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yH/9hz6FH09kgusRNWrqPg
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-03-05 13:07:45
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SXJ+FzgNDad87OKSBH2qrg
1;