Support push notification of repository changes

[?]
Feb 25, 2013, 8:04 PM
PCKLFRT5IZVLG47GQQ23GBSROKUR4CUEZW4PRVGREHNDFTCZ7VBAC

Dependencies

  • [2] 3WUMSTU5 Use getMainOutput
  • [3] J74UTA3I Handle the case where a jobset has never been evaluated
  • [4] GCHNNFZP
  • [5] TIOBBINA * Some renaming.
  • [6] PMNWRTGJ Add multiple output support
  • [7] HOI5XQHS * Don't use a config file by default. This frees up $HYDRA_CONFIG so
  • [8] OVR2RWBI hydra-evaluator: Always pick the jobset that hasn't been evaluated longest
  • [9] JM3DPYOM generated schema with new dbix class schema loader, grrrrrr
  • [10] ND75XNSQ Allow showing all evaluations that contain a given build
  • [11] LBNVQXUB * Build the /build stuff in a separate controller.
  • [12] RFE6T5LG * Store jobset evaluations in the database explicitly. This includes
  • [13] NI5BVF2V * In job inputs of type "build", allow the project and jobset names of
  • [14] SB2V735V Keep track of the database schema version
  • [15] WQXF2T3D hydra-evaluator: Don't require $HYDRA_CONFIG
  • [16] 2SP37OH2 Send ETag and Expires headers
  • [17] X27GNHDV * Basic job info in the database.
  • [18] QTFVCDIF added hide feature for project/jobset
  • [19] 5GRJZZOR
  • [20] Y6AHH4TH Remove the logfile and logSize columns from the database
  • [21] VBUNNYXG Fix path to the session data
  • [22] HSVVEKTY * Start of a JSON API to get information about a specific build.
  • [23] FGQPXZIX hydra: make nr of build to keep configurable per jobset
  • [*] BKOIYITR added some json responses
  • [*] TH674WKJ add log diff to compare logs to previous builds
  • [*] LMETCA7G Cleanup
  • [*] HQGXL4MX Add validation for project and jobset names
  • [*] CS7T2XFI
  • [*] 4D4U5IPY * Allow jobsets to be disabled.
  • [*] J5UVLXOK * Start of a basic Catalyst web interface.
  • [*] N22GPKYT * Put info about logs / build products in the DB.
  • [*] 7ZYBTNJJ revert unmeant previous change which caused errors to stay, even after successful evaluation of jobs
  • [*] 2YXO5ZGQ Hydra/28: Rename "scheduler" to "evaluator"
  • [*] KN3VYE5P * Cleaned up the foreign key constraints.
  • [*] D5QIOJGP * Move everything up one directory.

Change contents

  • edit in src/lib/Hydra/Controller/API.pm at line 3
    [25.58]
    [25.58]
    use utf8;
  • edit in src/lib/Hydra/Controller/API.pm at line 23
    [25.370]
    [25.370]
    }
    sub end : ActionClass('RenderView') {
    my ($self, $c) = @_;
    if (scalar @{$c->error}) {
    $c->stash->{json}->{error} = join "\n", @{$c->error};
    $c->forward('View::JSON');
    $c->clear_errors;
    }
  • edit in src/lib/Hydra/Controller/API.pm at line 285
    [26.1228]
    [26.1228]
    }
    sub triggerJobset {
    my ($self, $c, $jobset) = @_;
    txn_do($c->model('DB')->schema, sub {
    $jobset->update({ triggertime => time });
    });
    push @{$c->{stash}->{json}->{jobsetsTriggered}}, $jobset->project->name . ":" . $jobset->name;
    }
    sub push : Chained('api') PathPart('push') Args(0) {
    my ($self, $c) = @_;
    $c->{stash}->{json}->{jobsetsTriggered} = [];
    my @jobsets = split /,/, ($c->request->params->{jobsets} // "");
    foreach my $s (@jobsets) {
    my ($p, $j) = parseJobsetName($s);
    my $jobset = $c->model('DB::Jobsets')->find($p, $j) or notFound($c, "Jobset ‘$p:$j’ does not exist.");
    next unless $jobset->project->enabled && $jobset->enabled;
    triggerJobset($self, $c, $jobset);
    }
    my @repos = split /,/, ($c->request->params->{repos} // "");
    foreach my $r (@repos) {
    triggerJobset($self, $c, $_) foreach $c->model('DB::Jobsets')->search(
    { 'project.enabled' => 1, 'me.enabled' => 1 },
    { join => 'project'
    , where => \ [ 'exists (select 1 from JobsetInputAlts where project = me.project and jobset = me.name and value = ?)', [ 'value', $r ] ]
    });
    }
    $c->forward('View::JSON');
  • replacement in src/lib/Hydra/Controller/Build.pm at line 566
    [4.210][4.210:333]()
    # !!! strip the json prefix
    $c->stash->{jsonBuildId} = $build->id;
    $c->stash->{jsonDrvPath} = $build->drvpath;
    [4.210]
    [2.0]
    $c->stash->{json}->{buildId} = $build->id;
    $c->stash->{json}->{drvPath} = $build->drvpath;
  • replacement in src/lib/Hydra/Controller/Build.pm at line 569
    [2.37][4.4123:4182](),[4.4123][4.4123:4182]()
    $c->stash->{jsonOutPath} = $out->path if defined $out;
    [2.37]
    [4.381]
    $c->stash->{json}->{outPath} = $out->path if defined $out;
  • edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 16
    [27.187]
    [28.1467]
    parseJobsetName
  • edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 173
    [28.2077]
    [29.367]
    sub parseJobsetName {
    my ($s) = @_;
    $s =~ /^($projectNameRE):($jobsetNameRE)$/ or die "invalid jobset specifier ‘$s’\n";
    return ($1, $2);
    }
  • edit in src/lib/Hydra/Schema/Jobsets.pm at line 65
    [4.18646]
    [4.18646]
    data_type: 'integer'
    is_nullable: 1
    =head2 triggertime
  • edit in src/lib/Hydra/Schema/Jobsets.pm at line 122
    [4.21230]
    [30.1752]
    "triggertime",
    { data_type => "integer", is_nullable => 1 },
  • replacement in src/lib/Hydra/Schema/Jobsets.pm at line 255
    [4.3136][4.6042:6184]()
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-01-22 13:29:36
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9smV/zbSSxQNLiBcnADFXA
    [4.3136]
    [4.22627]
    # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-02-25 19:10:12
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SvBgR0iH9NjVH4jvBATYPA
  • replacement in src/lib/Hydra.pm at line 48
    [4.546][4.546:581]()
    expose_stash => qr/^json/,
    [4.546]
    [4.581]
    expose_stash => 'json'
  • replacement in src/script/hydra-evaluator at line 24
    [4.59][4.59:85]()
    my $minCheckInterval = 1;
    [4.59]
    [4.85]
    my $minCheckInterval = 5 * 60;
  • edit in src/script/hydra-evaluator at line 234
    [3.146]
    [4.1451]
    my $triggerTime = $jobset->triggertime;
  • edit in src/script/hydra-evaluator at line 247
    [33.178]
    [4.2480]
    });
    }
    if (defined $triggerTime) {
    txn_do($db, sub {
    # Only clear the trigger time if the jobset hasn't been
    # triggered in the meantime. In that case, we need to
    # evaluate again.
    my $new = $jobset->get_from_storage();
    $jobset->update({ triggertime => undef })
    if $new->triggertime == $triggerTime;
  • edit in src/script/hydra-evaluator at line 263
    [4.9901][4.411:477]()
    # Check the jobset that hasn't been checked for the longest time.
  • edit in src/script/hydra-evaluator at line 264
    [4.499]
    [4.499]
    # If any jobset has been triggered by a push, check it.
  • replacement in src/script/hydra-evaluator at line 266
    [4.553][3.147:199]()
    { 'project.enabled' => 1, 'me.enabled' => 1
    [4.553]
    [3.199]
    { 'project.enabled' => 1, 'me.enabled' => 1, 'triggertime' => { '!=', undef },
    , -or => [ 'lastcheckedtime' => undef, 'lastcheckedtime' => { '<', time() - $minCheckInterval } ] },
    { join => 'project', order_by => [ 'triggertime' ], rows => 1 });
    # Otherwise, check the jobset that hasn't been checked for the
    # longest time (but don't check more often than the minimal check
    # interval).
    ($jobset) = $db->resultset('Jobsets')->search(
    { 'project.enabled' => 1, 'me.enabled' => 1,
  • replacement in src/script/hydra-evaluator at line 276
    [3.308][3.308:398]()
    { join => 'project', order_by => [ 'lastcheckedtime nulls first' ], rows => 1 });
    [3.308]
    [4.744]
    { join => 'project', order_by => [ 'lastcheckedtime nulls first' ], rows => 1 })
    unless defined $jobset;
  • edit in src/sql/hydra.sql at line 57
    [34.472]
    [35.5433]
    triggerTime integer, -- set if we were triggered by a push event
  • file addition: upgrade-10.sql (----------)
    [36.3004]
    alter table Jobsets add column triggerTime integer;