Store the inputs of each evaluation in the database

[?]
Apr 15, 2012, 6:36 PM
G2T4WAHINIIKTEKR4JBIRXO5IEKO7MPYD7U5PQ4AIX3WL54EPP3AC

Dependencies

  • [2] DDMYFZ5X Fix the jobset unchanged check
  • [3] KPZNJ33U * In views, support selecting a job that doesn't depend on the
  • [4] TJK27WSB Open the DB using Hydra::Model::DB->new
  • [5] RFE6T5LG * Store jobset evaluations in the database explicitly. This includes
  • [6] L2E6EVE2 * Merged the Build and Job tables.
  • [7] 5SHCWE7X * Prevent repeated evaluation of a jobset with the same inputs. This
  • [8] HPEG2RHV Merge the BuildResultInfo table into the Builds table
  • [9] SB2V735V Keep track of the database schema version
  • [10] SJLEZFC4 check getHydraPath in stead of Envvar HYDRA_DBI directly
  • [11] MOX7XJ2E Merge the BuildSchedulingInfo table into the Builds table
  • [12] ZTQEU5QS Hydra: Add support for maxSilent meta attribute (also already added timeout, but not implemented the actual timeout for the build yet)
  • [*] J5UVLXOK * Start of a basic Catalyst web interface.
  • [*] JM3DPYOM generated schema with new dbix class schema loader, grrrrrr
  • [*] D5QIOJGP * Move everything up one directory.
  • [*] N22GPKYT * Put info about logs / build products in the DB.
  • [*] 34DPX2OR * Create some more indices on tables that have a foreign key reference
  • [*] E2TOU3L6 * More indices.

Change contents

  • edit in src/lib/Hydra/Schema/Builds.pm at line 390
    [3.3211]
    [15.9677]
    =head2 jobsetevalinputs
    Type: has_many
    Related object: L<Hydra::Schema::JobsetEvalInputs>
  • edit in src/lib/Hydra/Schema/Builds.pm at line 397
    [15.9678]
    [3.10517]
    =cut
    __PACKAGE__->has_many(
    "jobsetevalinputs",
    "Hydra::Schema::JobsetEvalInputs",
    { "foreign.dependency" => "self.id" },
    {},
    );
  • replacement in src/lib/Hydra/Schema/Builds.pm at line 447
    [3.1182][3.6720:6862]()
    # Created by DBIx::Class::Schema::Loader v0.07014 @ 2012-02-29 18:56:22
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:w16c86FRReLPdA8H0yTIRg
    [3.1182]
    [3.3377]
    # Created by DBIx::Class::Schema::Loader v0.07014 @ 2012-04-15 16:38:10
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AltTdmkzfwBMYToTkj84vA
  • file addition: JobsetEvalInputs.pm (----------)
    [16.477]
    use utf8;
    package Hydra::Schema::JobsetEvalInputs;
    # Created by DBIx::Class::Schema::Loader
    # DO NOT MODIFY THE FIRST PART OF THIS FILE
    =head1 NAME
    Hydra::Schema::JobsetEvalInputs
    =cut
    use strict;
    use warnings;
    use base 'DBIx::Class::Core';
    =head1 TABLE: C<JobsetEvalInputs>
    =cut
    __PACKAGE__->table("JobsetEvalInputs");
    =head1 ACCESSORS
    =head2 eval
    data_type: 'integer'
    is_foreign_key: 1
    is_nullable: 0
    =head2 name
    data_type: 'text'
    is_nullable: 0
    =head2 altnr
    data_type: 'integer'
    is_nullable: 0
    =head2 type
    data_type: 'text'
    is_nullable: 0
    =head2 uri
    data_type: 'text'
    is_nullable: 1
    =head2 revision
    data_type: 'text'
    is_nullable: 1
    =head2 value
    data_type: 'text'
    is_nullable: 1
    =head2 dependency
    data_type: 'integer'
    is_foreign_key: 1
    is_nullable: 1
    =head2 path
    data_type: 'text'
    is_nullable: 1
    =head2 sha256hash
    data_type: 'text'
    is_nullable: 1
    =cut
    __PACKAGE__->add_columns(
    "eval",
    { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
    "name",
    { data_type => "text", is_nullable => 0 },
    "altnr",
    { data_type => "integer", is_nullable => 0 },
    "type",
    { data_type => "text", is_nullable => 0 },
    "uri",
    { data_type => "text", is_nullable => 1 },
    "revision",
    { data_type => "text", is_nullable => 1 },
    "value",
    { data_type => "text", is_nullable => 1 },
    "dependency",
    { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
    "path",
    { data_type => "text", is_nullable => 1 },
    "sha256hash",
    { data_type => "text", is_nullable => 1 },
    );
    =head1 PRIMARY KEY
    =over 4
    =item * L</eval>
    =item * L</name>
    =item * L</altnr>
    =back
    =cut
    __PACKAGE__->set_primary_key("eval", "name", "altnr");
    =head1 RELATIONS
    =head2 dependency
    Type: belongs_to
    Related object: L<Hydra::Schema::Builds>
    =cut
    __PACKAGE__->belongs_to(
    "dependency",
    "Hydra::Schema::Builds",
    { id => "dependency" },
    { join_type => "LEFT" },
    );
    =head2 eval
    Type: belongs_to
    Related object: L<Hydra::Schema::JobsetEvals>
    =cut
    __PACKAGE__->belongs_to("eval", "Hydra::Schema::JobsetEvals", { id => "eval" }, {});
    # Created by DBIx::Class::Schema::Loader v0.07014 @ 2012-04-15 16:38:10
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PNxVBdoUNeUzf5BztiIhLw
    # You can replace this text with custom code or comments, and it will be preserved on regeneration
    1;
  • edit in src/lib/Hydra/Schema/JobsetEvals.pm at line 118
    [3.4250]
    [3.4250]
    =head2 jobsetevalinputs
    Type: has_many
    Related object: L<Hydra::Schema::JobsetEvalInputs>
  • edit in src/lib/Hydra/Schema/JobsetEvals.pm at line 125
    [3.4251]
    [3.4251]
    =cut
    __PACKAGE__->has_many(
    "jobsetevalinputs",
    "Hydra::Schema::JobsetEvalInputs",
    { "foreign.eval" => "self.id" },
    {},
    );
  • replacement in src/lib/Hydra/Schema/JobsetEvals.pm at line 160
    [3.18354][3.18354:18496]()
    # Created by DBIx::Class::Schema::Loader v0.07014 @ 2011-12-05 14:15:43
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eQtF5bcR/qZ625LxWBc7ug
    [3.18354]
    [3.1674]
    # Created by DBIx::Class::Schema::Loader v0.07014 @ 2012-04-15 16:38:10
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Yt39QbkhH52hfpJZ4ZECeg
  • edit in src/script/hydra-evaluator at line 173
    [3.6520]
    [3.6520]
    }
    foreach my $name (keys %{$inputInfo}) {
    for (my $n = 0; $n < scalar(@{$inputInfo->{$name}}); $n++) {
    my $input = $inputInfo->{$name}->[$n];
    $ev->jobsetevalinputs->create(
    { name => $name
    , altnr => $n
    , type => $input->{type}
    , uri => $input->{uri}
    , revision => $input->{revision}
    , value => $input->{value}
    , dependency => $input->{id}
    , path => $input->{storePath} || "" # !!! temporary hack
    , sha256hash => $input->{sha256hash}
    });
    }
  • edit in src/script/hydra-evaluator at line 191
    [3.6534]
    [2.455]
  • edit in src/sql/hydra.sql at line 443
    [3.3537]
    [3.7669]
    );
    create table JobsetEvalInputs (
    eval integer not null references JobsetEvals(id) on delete cascade,
    name text not null,
    altNr integer not null,
    -- Copied from the jobsetinputs from which the build was created.
    type text not null,
    uri text,
    revision text,
    value text,
    dependency integer, -- build ID of the input, for type == 'build'
    path text,
    sha256hash text,
    primary key (eval, name, altNr),
    foreign key (dependency) references Builds(id)
  • edit in src/sql/hydra.sql at line 545
    [18.72]
    [19.427]
    create index IndexJobsetEvalMembersOnEval on JobsetEvalMembers(eval);
  • file addition: upgrade-6.sql (----------)
    [16.3004]
    create index IndexJobsetEvalMembersOnEval on JobsetEvalMembers(eval);
    -- Inputs of jobset evals.
    create table JobsetEvalInputs (
    eval integer not null references JobsetEvals(id) on delete cascade,
    name text not null,
    altNr integer not null,
    -- Copied from the jobsetinputs from which the build was created.
    type text not null,
    uri text,
    revision text,
    value text,
    dependency integer, -- build ID of the input, for type == 'build'
    path text,
    sha256hash text,
    primary key (eval, name, altNr),
    foreign key (dependency) references Builds(id)
    );
    -- Reconstruct the repository inputs for pre-existing evals. This is
    -- tricky (and not entirely possible) because builds are not uniquely
    -- part of a single eval, so they may have different inputs.
    -- For Subversion or Bazaar inputs, pick the highest revision for each
    -- input.
    insert into JobsetEvalInputs (eval, name, altNr, type, uri, revision)
    select e.id, b.name, 0, max(b.type), max(b.uri), max(b.revision)
    from (select id from JobsetEvals where hasNewBuilds = 1) e
    join JobsetEvalMembers m on e.id = m.eval
    join BuildInputs b on b.build = m.build
    where (b.type = 'svn' or b.type = 'svn-checkout' or b.type = 'bzr' or b.type = 'bzr-checkout')
    group by e.id, b.name
    having count(distinct type) = 1 and count(distinct uri) = 1;
    -- For other inputs there is no "best" revision to pick, so only do
    -- the conversion if there is only one.
    insert into JobsetEvalInputs (eval, name, altNr, type, uri, revision)
    select e.id, b.name, 0, max(b.type), max(uri), max(revision)
    from (select id from JobsetEvals where hasNewBuilds = 1) e
    join JobsetEvalMembers m on e.id = m.eval
    join BuildInputs b on b.build = m.build
    where (b.type != 'svn' and b.type != 'svn-checkout' and b.type != 'bzr' and b.type != 'bzr-checkout')
    and b.uri is not null and b.revision is not null
    and not exists(select 1 from JobsetEvalInputs i where e.id = i.eval and b.name = i.name)
    group by e.id, b.name
    having count(distinct type) = 1 and count(distinct uri) = 1 and count(distinct revision) = 1;