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
F14007313: D10322.diff
Tue, Oct 29, 3:38 AM
F13999737: D10322.diff
Thu, Oct 24, 4:55 PM
F13967259: D10322.id24916.diff
Wed, Oct 16, 12:34 PM
F13967258: D10322.id24883.diff
Wed, Oct 16, 12:34 PM
F13956742: D10322.id24852.diff
Mon, Oct 14, 6:56 AM
Unknown Object (File)
Oct 8 2024, 11:53 PM
Unknown Object (File)
Oct 1 2024, 9:07 AM
Unknown Object (File)
Oct 1 2024, 12:09 AM
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 2312
Build 2316: [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
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).