* Allow scheduled builds to be cancelled. They're not removed from

[?]
Mar 6, 2009, 12:49 PM
ZILILXXKP4Z64UGIXIPTQ3KXPV76LFGSXVFLMLCO2HJBCQ5GP6AQC

Dependencies

  • [2] FEMR2C5W
  • [3] A52HEFHQ * Allow builds to be restarted (if they failed with a transient error,
  • [4] BD3GRK4B * Get rid of "positive failures" and separate log phases.
  • [5] WYN733ST * Store build duration, handle cached builds.
  • [6] XHVZXX6N
  • [7] L2E6EVE2 * Merged the Build and Job tables.
  • [8] IMY5UQE3
  • [9] OD5FSS5A * Quick hack to allow viewing of dependency graphs (via nix-store -q
  • [10] FPK5LF53 * Put the project-related actions in a separate controller. Put the
  • [11] LBNVQXUB * Build the /build stuff in a separate controller.
  • [12] KOTB7BKV
  • [13] CMU3YKOU * Store the release name.
  • [14] J5UVLXOK * Start of a basic Catalyst web interface.
  • [15] 67P45PY4
  • [16] WHAFVCEI
  • [17] BHZXGT2H * Channels: provide an index page that lists all the packages in the
  • [18] SMM4HQTP * Put actions related to builds under /build (e.g. /log/<buildid>
  • [19] H7CNGK4O * Log evaluation errors etc. in the DB.
  • [20] 2JQ7WEFM
  • [*] N22GPKYT * Put info about logs / build products in the DB.

Change contents

  • replacement in src/lib/Hydra/Controller/Build.pm at line 33
    [4.61][3.0:55]()
    $c->stash->{flashMsg} = $c->flash->{afterRestart};
    [4.61]
    [4.941]
    $c->stash->{flashMsg} = $c->flash->{buildMsg};
  • replacement in src/lib/Hydra/Controller/Build.pm at line 159
    [3.60][3.60:121]()
    sub restart : Chained('build') PathPart('restart') Args(0) {
    [3.60]
    [3.121]
    sub restart : Chained('build') PathPart Args(0) {
  • edit in src/lib/Hydra/Controller/Build.pm at line 165
    [3.230][3.230:353]()
    error($c, "This build cannot be restarted.")
    unless $build->finished && $build->resultInfo->buildstatus == 3;
  • edit in src/lib/Hydra/Controller/Build.pm at line 167
    [3.396]
    [3.396]
    error($c, "This build cannot be restarted.")
    unless $build->finished &&
    ($build->resultInfo->buildstatus == 3 ||
    $build->resultInfo->buildstatus == 4);
  • replacement in src/lib/Hydra/Controller/Build.pm at line 186
    [3.757][3.757:818]()
    $c->flash->{afterRestart} = "Build has been restarted.";
    [3.757]
    [3.818]
    $c->flash->{buildMsg} = "Build has been restarted.";
    $c->res->redirect($c->uri_for($self->action_for("view_build"), $c->req->captures));
    }
    sub cancel : Chained('build') PathPart Args(0) {
    my ($self, $c) = @_;
    my $build = $c->stash->{build};
    requireProjectOwner($c, $build->project);
    $c->model('DB')->schema->txn_do(sub {
    error($c, "This build cannot be cancelled.")
    if $build->finished || $build->schedulingInfo->busy;
    # !!! Actually, it would be nice to be able to cancel busy
    # builds as well, but we would have to send a signal or
    # something to the build process.
    $build->finished(1);
    $build->timestamp(time());
    $build->update;
    $c->model('DB::BuildResultInfo')->create(
    { id => $build->id
    , iscachedbuild => 0
    , buildstatus => 4 # = cancelled
    });
    $build->schedulingInfo->delete;
    });
    $c->flash->{buildMsg} = "Build has been cancelled.";
  • edit in src/root/build.tt at line 43
    [4.2351]
    [4.665]
    [% ELSIF build.resultInfo.buildstatus == 4 %]
    <img src="/static/images/failure.gif" alt="Failed" />
    <span class="error">Cancelled by user</span>
  • edit in src/root/build.tt at line 50
    [4.2449]
    [3.1781]
    [% END %]
    [% IF build.resultInfo.buildstatus == 3 || build.resultInfo.buildstatus == 4 %]
  • replacement in src/root/build.tt at line 53
    [3.1881][3.1881:1952]()
    <button id="delete-project" type="submit">Restart</button>
    [3.1881]
    [3.1952]
    <button id="restart" type="submit">Restart</button>
  • edit in src/root/build.tt at line 61
    [4.944]
    [4.944]
    [% IF c.user_exists %]
    <form action="[% c.uri_for('/build' build.id 'cancel') %]" method="post" class="inline">
    <button id="cancel" type="submit">Cancel</button>
    </form>
    [% END %]
  • edit in src/root/build.tt at line 128
    [2.275][2.275:283](),[2.283][4.6113:6139](),[4.1478][4.6113:6139](),[4.6139][4.1478:1485](),[4.1478][4.1478:1485](),[4.1485][4.0:28](),[4.28][4.4807:4965](),[4.3826][4.97:141](),[4.4965][4.97:141](),[4.6297][4.97:141](),[4.97][4.97:141](),[4.141][4.4966:5122](),[4.3960][4.209:224](),[4.5122][4.209:224](),[4.6453][4.209:224](),[4.209][4.209:224](),[4.224][4.1485:1527](),[4.1485][4.1485:1527](),[4.1527][4.6454:6500](),[4.6500][4.1562:1611](),[4.1562][4.1562:1611](),[4.1611][4.6501:6570](),[4.423][4.423:449]()
    </tr>
    [% IF build.finished %]
    <tr>
    <th>Build started:</th>
    <td>[% IF build.resultInfo.starttime %][% PROCESS renderDateTime timestamp = build.resultInfo.starttime %][% ELSE %]<em>(cached build)</em>[% END %]</td>
    </tr>
    <tr>
    <th>Build finished:</th>
    <td>[% IF build.resultInfo.stoptime %][% PROCESS renderDateTime timestamp = build.resultInfo.stoptime %][% ELSE %]<em>(cached build)</em>[% END %]</td>
    </tr>
    <tr>
    <th>Duration (seconds):</th>
    <td>
    [% IF build.resultInfo.iscachedbuild %]
    <em>(cached build)</em>
    [% ELSE %]
    [% build.resultInfo.stoptime - build.resultInfo.starttime %]
    [% END %]
    </td>
  • replacement in src/root/build.tt at line 129
    [4.2327][4.2450:2486](),[4.6629][4.2450:2486]()
    [% IF build.resultInfo.logfile %]
    [4.6629]
    [4.2486]
    [% IF build.finished && build.resultInfo.buildstatus != 4 %]
    <tr>
    <th>Build started:</th>
    <td>[% IF build.resultInfo.starttime %][% PROCESS renderDateTime timestamp = build.resultInfo.starttime %][% ELSE %]<em>(cached build)</em>[% END %]</td>
    </tr>
    <tr>
    <th>Build finished:</th>
    <td>[% IF build.resultInfo.stoptime %][% PROCESS renderDateTime timestamp = build.resultInfo.stoptime %][% ELSE %]<em>(cached build)</em>[% END %]</td>
    </tr>
  • replacement in src/root/build.tt at line 139
    [4.2495][4.2495:2519]()
    <th>Logfile:</th>
    [4.2495]
    [4.2519]
    <th>Duration (seconds):</th>
  • replacement in src/root/build.tt at line 141
    [4.2530][4.3832:3922]()
    <a href="[% c.uri_for('/build' build.id 'log') %]"><strong>Available</strong></a>
    [4.2530]
    [4.2612]
    [% IF build.resultInfo.iscachedbuild %]
    <em>(cached build)</em>
    [% ELSE %]
    [% build.resultInfo.stoptime - build.resultInfo.starttime %]
    [% END %]
  • edit in src/root/build.tt at line 148
    [4.2634]
    [4.2634]
    [% IF build.resultInfo.logfile %]
    <tr>
    <th>Logfile:</th>
    <td>
    <a href="[% c.uri_for('/build' build.id 'log') %]"><strong>Available</strong></a>
    </td>
    </tr>
    [% END %]
  • replacement in src/root/build.tt at line 157
    [4.2646][4.6629:6721](),[4.6629][4.6629:6721](),[4.449][4.7964:7972](),[4.6721][4.7964:7972](),[4.7964][4.7964:7972](),[4.7972][4.971:1037](),[4.1037][4.2306:2363](),[4.2363][4.1085:1093](),[4.1085][4.1085:1093]()
    [% ELSE %]
    <tr>
    <th>Priority:</th>
    <td>[% build.schedulingInfo.priority %]</td>
    </tr>
    [% IF build.schedulingInfo.busy %]
    <tr>
    <th>Logfile:</th>
    <td><tt>[% build.schedulingInfo.logfile %]</tt></td>
    </tr>
    [4.2646]
    [4.6722]
    [% IF !build.finished %]
    <tr>
    <th>Priority:</th>
    <td>[% build.schedulingInfo.priority %]</td>
    </tr>
    [% IF build.schedulingInfo.busy %]
    <tr>
    <th>Logfile:</th>
    <td><tt>[% build.schedulingInfo.logfile %]</tt></td>
    </tr>
    [% END %]
  • edit in src/root/build.tt at line 169
    [4.6734][4.1094:1106]()
    [% END %]
  • edit in src/sql/hydra.sql at line 64
    [4.4847]
    [4.4847]
    -- 4 = build cancelled (removed from queue; never built)