From 39cf0134728aaa4bc08dbd4b599e798fc59c8dc9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 22 Nov 2015 14:17:04 -0800 Subject: [PATCH] Add `objectPHID` keys to Harbormaster task schedulers Summary: Fixes T9816. It's currently hard to hunt down some particulars in the worker queue if things go awry in Harbormaster. Supplement the queue with `objectPHID` keys so we can hunt tasks down more easily if the issues in T9816 continue. Test Plan: ``` mysql> select * from worker_archivetask order by id desc limit 30; +--------+------------------------------------------------+-----------------------------------+--------------+--------------+--------+--------+----------+-------------+--------------+----------+--------------------------------+ | id | taskClass | leaseOwner | leaseExpires | failureCount | dataID | result | duration | dateCreated | dateModified | priority | objectPHID | +--------+------------------------------------------------+-----------------------------------+--------------+--------------+--------+--------+----------+-------------+--------------+----------+--------------------------------+ | 496024 | HarbormasterTargetWorker | 8514:1448232248:Orbital.local:3 | 1448318648 | 0 | 311880 | 0 | 233758 | 1448232248 | 1448232248 | 2000 | PHID-HMBT-thq4oof4byllmbc4q3tt | | 496023 | PhabricatorApplicationTransactionPublishWorker | 8514:1448232247:Orbital.local:1 | 1448239447 | 0 | 311879 | 0 | 53731 | 1448232247 | 1448232247 | 1000 | PHID-HMBD-i6zo2ltc73rre7o54s7v | | 496022 | HarbormasterBuildWorker | 8514:1448232247:Orbital.local:2 | 1448239447 | 0 | 311878 | 0 | 30736 | 1448232248 | 1448232248 | 2000 | PHID-HMBD-i6zo2ltc73rre7o54s7v | ... ``` Reviewers: chad Reviewed By: chad Maniphest Tasks: T9816 Differential Revision: https://secure.phabricator.com/D14541 --- .../conduit/HarbormasterSendMessageConduitAPIMethod.php | 7 ++++++- .../editor/HarbormasterBuildTransactionEditor.php | 3 +++ .../harbormaster/engine/HarbormasterBuildEngine.php | 3 +++ .../harbormaster/storage/HarbormasterBuildable.php | 3 +++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php index 6d68b0a8b6..9c3f88d631 100644 --- a/src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php +++ b/src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php @@ -256,10 +256,15 @@ final class HarbormasterSendMessageConduitAPIMethod // If the build has completely paused because all steps are blocked on // waiting targets, this will resume it. + $build = $build_target->getBuild(); + PhabricatorWorker::scheduleTask( 'HarbormasterBuildWorker', array( - 'buildID' => $build_target->getBuild()->getID(), + 'buildID' => $build->getID(), + ), + array( + 'objectPHID' => $build->getPHID(), )); return null; diff --git a/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php b/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php index b8c39146cb..0727a473ec 100644 --- a/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php +++ b/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php @@ -98,6 +98,9 @@ final class HarbormasterBuildTransactionEditor 'HarbormasterBuildWorker', array( 'buildID' => $build->getID(), + ), + array( + 'objectPHID' => $build->getPHID(), )); } diff --git a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php index 36ca48b060..5eabd85034 100644 --- a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php +++ b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php @@ -81,6 +81,9 @@ final class HarbormasterBuildEngine extends Phobject { 'HarbormasterTargetWorker', array( 'targetID' => $target->getID(), + ), + array( + 'objectPHID' => $target->getPHID(), )); } diff --git a/src/applications/harbormaster/storage/HarbormasterBuildable.php b/src/applications/harbormaster/storage/HarbormasterBuildable.php index 3a7df73f52..6286072b42 100644 --- a/src/applications/harbormaster/storage/HarbormasterBuildable.php +++ b/src/applications/harbormaster/storage/HarbormasterBuildable.php @@ -184,6 +184,9 @@ final class HarbormasterBuildable extends HarbormasterDAO 'HarbormasterBuildWorker', array( 'buildID' => $build->getID(), + ), + array( + 'objectPHID' => $build->getPHID(), )); return $build;