Allow build to be bumped to the front of the queue via the web interface

[?]
Aug 10, 2015, 2:18 PM
WE5Q2NVIIK4R2DUUZYLJFQVYK5O26EDEJRPK3CPGWHU3SEAC2DQAC

Dependencies

  • [2] YMNEN6YY Queue: Remove the scheduling priority
  • [3] T5BIOVJE Add support for tracking custom metrics
  • [4] 46ADBTMQ Start steps in order of ascending build ID
  • [5] TLZ2SPBR
  • [6] VJHIHMEH * Store the meta.longDescription and meta.license attributes in the
  • [7] RU7AQO7U * Role-based access control. Only admins can create projects. Only
  • [8] 4S5JF5JP Use latest DBIx::Class::Schema::Loader
  • [9] YTIDBFGU Drop unused "disabled" columns
  • [10] ZVTSOVHN * Support Subversion checkouts.
  • [11] QNDXPVCI * Store the jobset's nixExprPath and nixExprInput fields in a build to
  • [12] ZI535LI6 * hydra: 'new' UI for project/jobset/job/build
  • [13] GNIEG2GC * Disambiguate jobs by jobset name. I.e. jobs with the same name in
  • [14] 4I2HF4L3 Unindent
  • [15] AHTEIK7G * Added a maintainers field to the Builds table.
  • [16] TWVSALRL * Allow the maximum number of concurrent builds per platform to be
  • [17] R5D7DZPE
  • [18] ECBA3GQO * Make the schema class names match the case of the SQL table names.
  • [19] CLJQCY2X * Store info about all the build actions and allow them to be
  • [20] MHVIT4JY Split hydra-queue-runner.cc more
  • [21] 3ZCEPLNO
  • [22] YAPITGB3 * Boolean inputs.
  • [23] V4RNHJNR * Add a link to each project's homepage. Suggested by karltk.
  • [24] B72GLND4
  • [25] XJRJ4J7M Add user registration
  • [26] JTHWA6AM Rename aggregate members to constituents
  • [27] LCKWLQW3 * In Sqlite "release" is now a keyword, so use "release_" instead.
  • [28] 3E6IP3R3 * Add the name of the jobset to ReleaseSetJobs, otherwise we can't
  • [29] FHF6IZJQ * Basic release management: releases are now dynamically computed as
  • [30] L2E6EVE2 * Merged the Build and Job tables.
  • [31] BD3GRK4B * Get rid of "positive failures" and separate log phases.
  • [32] S5PV6IIM * Represent jobs explicitly in the DB.
  • [33] SHBLLAVH * More global substitution.
  • [34] G2T4WAHI Store the inputs of each evaluation in the database
  • [35] PMNWRTGJ Add multiple output support
  • [36] 37R34XJO * Negative caching: don't perform a build if a dependency already
  • [37] CMU3YKOU * Store the release name.
  • [38] LZVO64YG Merge in the first bits of the API work
  • [39] EYNG4EL4 * Regenerate the bindings from a clean sqlite database.
  • [40] 6BLUKEQ2 * Caching of "path" inputs, and fake a revision number for those.
  • [41] IK53RV4V
  • [42] D3DIBMOK * For products that are directories (like manuals), allow a default
  • [43] Y6AHH4TH Remove the logfile and logSize columns from the database
  • [44] YTZOC7C5 * Editing of jobset inputs.
  • [45] S66BOMVU * Added authentication.
  • [46] H7CNGK4O * Log evaluation errors etc. in the DB.
  • [47] BHZXGT2H * Channels: provide an index page that lists all the packages in the
  • [48] 4CELXP7P Remove the longDescription field
  • [49] OG3Z3QGC Namespace cleanup
  • [50] KOTB7BKV
  • [51] HJOEIMLR Refactor
  • [52] TQKGQ5R3
  • [53] SJLEZFC4 check getHydraPath in stead of Envvar HYDRA_DBI directly
  • [54] MOX7XJ2E Merge the BuildSchedulingInfo table into the Builds table
  • [55] FTPCV25M Store aggregate members in the database
  • [56] SHIENRAL Clean up root controller
  • [*] LBNVQXUB * Build the /build stuff in a separate controller.
  • [*] Z6MDQIGO * A quick (non-Web 2.0) interface to manually add builds to a release.
  • [*] J5UVLXOK * Start of a basic Catalyst web interface.
  • [*] JIJDYWPY Remove the Build menu from the top bar
  • [*] N22GPKYT * Put info about logs / build products in the DB.
  • [*] RVHBV3B3 Notify the queue runner when a build is deleted
  • [*] D5QIOJGP * Move everything up one directory.

Change contents

  • replacement in src/hydra-queue-runner/dispatcher.cc at line 147
    [4.749][4.749:811]()
    return a_->lowestBuildID < b_->lowestBuildID;
    [4.749]
    [4.811]
    return
    a_->highestGlobalPriority != b_->highestGlobalPriority ? a_->highestGlobalPriority > b_->highestGlobalPriority :
    a_->lowestBuildID < b_->lowestBuildID;
  • edit in src/hydra-queue-runner/queue-monitor.cc at line 28
    [5.20719]
    [5.20719]
    receiver buildsBumped(*conn, "builds_bumped");
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 48
    [5.21315][5.21315:21491]()
    if (buildsCancelled.get() || buildsDeleted.get()) {
    printMsg(lvlTalkative, "got notification: builds cancelled");
    removeCancelledBuilds(*conn);
    [5.21315]
    [5.21491]
    if (buildsCancelled.get() || buildsDeleted.get() || buildsBumped.get()) {
    printMsg(lvlTalkative, "got notification: builds cancelled or bumped");
    processQueueChange(*conn);
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 68
    [5.21931][3.1830:2018]()
    auto res = txn.parameterized("select id, project, jobset, job, drvPath, maxsilent, timeout, timestamp from Builds where id > $1 and finished = 0 order by id")(lastBuildId).exec();
    [5.21931]
    [5.22108]
    auto res = txn.parameterized("select id, project, jobset, job, drvPath, maxsilent, timeout, timestamp, globalPriority from Builds where id > $1 and finished = 0 order by id")(lastBuildId).exec();
  • edit in src/hydra-queue-runner/queue-monitor.cc at line 86
    [3.2258]
    [5.22781]
    build->globalPriority = row["globalPriority"].as<int>();
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 233
    [4.2401][4.2401:2765]()
    /* Update the lowest build ID field of each dependency. This
    is used by the dispatcher to start steps in order of build
    ID. */
    visitDependencies([&](const Step::ptr & step) {
    auto step_(step->state.lock());
    step_->lowestBuildID = std::min(step_->lowestBuildID, build->id);
    }, build->toplevel);
    [4.2401]
    [5.28327]
    build->propagatePriorities();
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 246
    [5.28665][5.28665:28718]()
    void State::removeCancelledBuilds(Connection & conn)
    [5.28665]
    [5.28718]
    void Build::propagatePriorities()
    {
    /* Update the highest global priority and lowest build ID fields
    of each dependency. This is used by the dispatcher to start
    steps in order of descending global priority and ascending
    build ID. */
    visitDependencies([&](const Step::ptr & step) {
    auto step_(step->state.lock());
    step_->highestGlobalPriority = std::max(step_->highestGlobalPriority, globalPriority);
    step_->lowestBuildID = std::min(step_->lowestBuildID, id);
    }, toplevel);
    }
    void State::processQueueChange(Connection & conn)
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 263
    [5.28768][5.28768:28802]()
    std::set<BuildID> currentIds;
    [5.28768]
    [5.28802]
    std::map<BuildID, int> currentIds;
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 266
    [5.28838][5.28838:28911]()
    auto res = txn.exec("select id from Builds where finished = 0");
    [5.28838]
    [5.28911]
    auto res = txn.exec("select id, globalPriority from Builds where finished = 0");
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 268
    [5.28948][5.28948:29004]()
    currentIds.insert(row["id"].as<BuildID>());
    [5.28948]
    [5.29004]
    currentIds[row["id"].as<BuildID>()] = row["globalPriority"].as<BuildID>();
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 274
    [5.29106][5.29106:29167]()
    if (currentIds.find(i->first) == currentIds.end()) {
    [5.29106]
    [5.29167]
    auto b = currentIds.find(i->first);
    if (b == currentIds.end()) {
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 279
    [5.29360][5.29360:29392]()
    } else
    ++i;
    [5.29360]
    [5.29392]
    continue;
    }
    if (i->second->globalPriority < b->second) {
    printMsg(lvlInfo, format("priority of build %1% increased") % i->first);
    i->second->globalPriority = b->second;
    i->second->propagatePriorities();
    }
    ++i;
  • edit in src/hydra-queue-runner/state.hh at line 74
    [5.2196]
    [5.2196]
    int globalPriority;
  • edit in src/hydra-queue-runner/state.hh at line 84
    [3.2568]
    [5.2276]
    void propagatePriorities();
  • replacement in src/hydra-queue-runner/state.hh at line 119
    [4.2767][4.2767:2825]()
    /* The lowest build ID depending on this step. */
    [4.2767]
    [4.2825]
    /* The highest global priority of any build depending on this
    step. */
    int highestGlobalPriority{0};
    /* The lowest ID of any build depending on this step. */
  • edit in src/hydra-queue-runner/state.hh at line 292
    [5.7626]
    [5.764]
    /* Check the queue for new builds. */
  • replacement in src/hydra-queue-runner/state.hh at line 295
    [5.7733][5.7733:7784]()
    void removeCancelledBuilds(Connection & conn);
    [5.7733]
    [5.7784]
    /* Handle cancellation, deletion and priority bumps. */
    void processQueueChange(Connection & conn);
  • edit in src/lib/Hydra/Controller/Build.pm at line 478
    [59.97]
    [5.5642]
    sub bump : Chained('buildChain') PathPart('bump') {
    my ($self, $c, $x) = @_;
    my $build = $c->stash->{build};
    requireProjectOwner($c, $build->project); # FIXME: require admin?
    $c->model('DB')->schema->txn_do(sub {
    $build->update({globalpriority => time()});
    });
    $c->flash->{successMsg} = "Build has been bumped to the front of the queue.";
    $c->res->redirect($c->uri_for($self->action_for("build"), $c->req->captures));
    }
  • replacement in src/lib/Hydra/Controller/Root.pm at line 91
    [5.22015][2.0:92]()
    entity => [$c->model('DB::Builds')->search({finished => 0}, { order_by => ["id"]})]
    [5.22015]
    [5.22247]
    entity => [$c->model('DB::Builds')->search({finished => 0}, { order_by => ["globalpriority desc", "id"]})]
  • edit in src/lib/Hydra/Schema/Builds.pm at line 136
    [5.4273]
    [5.4273]
    data_type: 'integer'
    default_value: 0
    is_nullable: 0
    =head2 globalpriority
  • edit in src/lib/Hydra/Schema/Builds.pm at line 249
    [5.4673]
    [5.4673]
    { data_type => "integer", default_value => 0, is_nullable => 0 },
    "globalpriority",
  • replacement in src/lib/Hydra/Schema/Builds.pm at line 561
    [5.3378][3.6492:6634]()
    # Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-07-30 16:52:20
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Y2lDtgY8EBLOuCHAI8fWRQ
    [5.3378]
    [5.4481]
    # Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-08-10 15:10:41
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rjifgnPtjY96MaQ7eiGzaA
  • edit in src/root/build.tt at line 99
    [61.972]
    [61.972]
    <li><a href="[% c.uri_for('/build' build.id 'bump') %]">Bump up</a></li>
  • replacement in src/sql/hydra.sql at line 159
    [5.9349][5.7697:7740]()
    -- Information about scheduled builds.
    [5.9349]
    [5.9469]
    -- Priority within a jobset, set via meta.schedulingPriority.
  • edit in src/sql/hydra.sql at line 161
    [5.9515]
    [5.9515]
    -- Priority among all builds, used by the admin to bump builds to
    -- the front of the queue via the web interface.
    globalPriority integer not null default 0,
  • edit in src/sql/hydra.sql at line 225
    [63.395]
    [63.395]
    create function notifyBuildBumped() returns trigger as 'begin notify builds_bumped; return null; end;' language plpgsql;
    create trigger BuildBumped after update on Builds for each row
    when (old.globalPriority != new.globalPriority) execute procedure notifyBuildBumped();
  • file addition: upgrade-40.sql (----------)
    [64.3004]
    alter table Builds add column globalPriority integer not null default 0;
    create function notifyBuildBumped() returns trigger as 'begin notify builds_bumped; return null; end;' language plpgsql;
    create trigger BuildBumped after update on Builds for each row
    when (old.globalPriority != new.globalPriority) execute procedure notifyBuildBumped();