Page MenuHomePhabricator

Split Harbormaster workers apart so build steps can run in parallel
ClosedPublic

Authored by epriestley on Jan 4 2014, 8:25 PM.
Tags
None
Referenced Files
F18737728: D7890.id.diff
Wed, Oct 1, 12:18 PM
F18727677: D7890.diff
Tue, Sep 30, 8:41 AM
F18625688: D7890.diff
Mon, Sep 15, 11:19 PM
F18557093: D7890.id.diff
Mon, Sep 8, 7:51 PM
F18513084: D7890.diff
Fri, Sep 5, 9:09 AM
F18437115: D7890.id.diff
Aug 31 2025, 11:47 AM
F18413951: D7890.diff
Aug 30 2025, 8:05 AM
F17939353: D7890.id17873.diff
Jul 31 2025, 3:03 AM
Subscribers

Details

Summary

Ref T1049. Currently, the Harbormaster worker looks like this:

foreach (step) {
  run_step(step);
}

This means steps can't ever be run in parallel. Instead, split it into two workers. The "Build" worker starts things off, and basically does:

update_build();

(We could theoretically do this in the original process because it should never take very long, but since there's a lock and it's a little bit complex it seemed cleaner to separate it.)

The "Target" worker runs an individual target (like a command, or an HTTP request, or whatever), then updates the build:

run_one_step(step);
update_build();

The new update_build() mechanism in HarbormasterBuildEngine does this, roughly:

figure_out_overall_status_of_all_steps();
if (build is done) { done(); }
if (build is fail) { fail(); }
foreach (step that is ready to run) {
  queue_target_worker_for_step(step);
}

So, overall:

  • The part of the code that updates Builds is completely separated from the part of the code that updates Targets.
  • Targets can run in parallel.
Test Plan
  • Ran a bunch of builds via bin/harbormaster build.
  • Ran a bunch of builds via web UI.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

btrahan added inline comments.
src/applications/harbormaster/engine/HarbormasterBuildEngine.php
23

typehint

epriestley updated this revision to Unknown Object (????).Jan 6 2014, 8:24 PM
  • Add missing typehint.