Page MenuHomePhabricator

Abort previous build targets when a build is restarted
ClosedPublic

Authored by hach-que on Aug 21 2014, 1:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 12, 6:19 AM
Unknown Object (File)
Thu, Sep 12, 6:19 AM
Unknown Object (File)
Thu, Sep 12, 6:19 AM
Unknown Object (File)
Thu, Sep 5, 9:36 AM
Unknown Object (File)
Thu, Sep 5, 3:25 AM
Unknown Object (File)
Thu, Aug 29, 9:48 PM
Unknown Object (File)
Sun, Aug 25, 4:35 PM
Unknown Object (File)
Aug 18 2024, 5:04 PM
Subscribers

Details

Summary

Ref T5936. This implements build implementations aborting early when the build has since been restarted. Build steps now periodically poll to see if the build's current generation does not match their generation, and they throw a HarbormasterBuildAbortedException if that is the case.

Test Plan

Tested locally on my machine with the sleep build step.

Diff Detail

Repository
rP Phabricator
Branch
abort
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 2328
Build 2332: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

hach-que retitled this revision from to Abort previous build targets when a build is restarted.
hach-que updated this object.
hach-que edited the test plan for this revision. (Show Details)
hach-que added a reviewer: epriestley.
epriestley edited edge metadata.
epriestley added inline comments.
src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php
239

Slightly cleaner as:

$futures = Futures($future);
foreach ($futures->setUpdateInterval(5) as $key => $future) {
  if ($future === null) {
    // Future has not resolved yet.
    $build->reload();
    if (should abort) {
      throw;
    }
  } else {
    // Future has resolved.
    return $future->resolve();
  }
}

As written, we'll spend most time in sleep() instead of select() and artificially limit how quickly we can transfer data to/from the subprocess over stdin/stdout.

src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php
67–68

We should clean this up at some point too but I want to fix the logging things anyway.

src/applications/harbormaster/step/HarbormasterSleepBuildStepImplementation.php
32

This is fine, sleepbuildstep is derp anyway

This revision now requires changes to proceed.Aug 21 2014, 1:22 PM
hach-que edited edge metadata.

Changes based on feedback

I updated the command build step while I was at it (from your comment, I understand that using setUpdateInterval allows it to pull more data from stderr / stdout faster?)

I tested this with a build plan that does "Lease Host" and "Run Command".

epriestley edited edge metadata.
This revision is now accepted and ready to land.Aug 22 2014, 7:16 PM
hach-que updated this revision to Diff 24916.

Closed by commit rP51b34c054429 (authored by @hach-que).