Skip to content

Commit

Permalink
* Store jobset evaluations in the database explicitly. This includes
Browse files Browse the repository at this point in the history
  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.
  • Loading branch information
edolstra committed Mar 5, 2010
1 parent 60ad8bd commit 7daca03
Show file tree
Hide file tree
Showing 11 changed files with 415 additions and 161 deletions.
15 changes: 14 additions & 1 deletion doc/dev-notes.txt
Expand Up @@ -45,6 +45,10 @@
* Changing the priority of a scheduled build:

update buildschedulinginfo set priority = 200 where id = <ID>;

* Changing the priority of all builds for a jobset:

update buildschedulinginfo set priority = 20 where id in (select id from builds where finished = 0 and project = 'nixpkgs' and jobset = 'trunk');


* Steps to install:
Expand Down Expand Up @@ -103,6 +107,10 @@
alter table Builds add column nixExprInput text;
alter table Builds add column nixExprPath text;

# Adding JobsetEvals.
drop table JobsetInputHashes;
(add JobsetEvals, JobsetEvalMembers)


* Job selection:

Expand Down Expand Up @@ -138,7 +146,7 @@

* Installing deps.nix in a profile for testing:

$ nix-env -p /nix/var/nix/profiles/per-user/eelco/hydra-deps -f deps.nix -i \* --arg pkgs 'import /home/eelco/Dev/nixpkgs {}'
$ nix-env -p $NIX_USER_PROFILE_DIR/hydra-deps -f deps.nix -i \* --arg pkgs 'import /etc/nixos/nixpkgs {}'


* select x.project, x.jobset, x.job, x.system, x.id, x.timestamp, r.buildstatus, b.id, b.timestamp
Expand All @@ -154,3 +162,8 @@
* Using PostgreSQL:

$ HYDRA_DBI="dbi:Pg:dbname=hydra;" hydra_server.pl


* Find the builds with the highest number of build steps:

select id, (select count(*) from buildsteps where build = x.id) as n from builds x order by n desc;
4 changes: 2 additions & 2 deletions src/lib/Hydra/Helper/AddBuilds.pm
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions src/lib/Hydra/Schema/BuildSchedulingInfo.pm
Expand Up @@ -44,7 +44,7 @@ __PACKAGE__->table("BuildSchedulingInfo");
=head2 locker
data_type: text
default_value: (empty string)
default_value: ''
is_nullable: 0
size: undef
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
18 changes: 16 additions & 2 deletions src/lib/Hydra/Schema/Builds.pm
Expand Up @@ -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;

Expand Down
102 changes: 102 additions & 0 deletions src/lib/Hydra/Schema/JobsetEvalMembers.pm
@@ -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;

0 comments on commit 7daca03

Please sign in to comment.