Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14016162
D11860.id28571.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D11860.id28571.diff
View Options
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
--- a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
@@ -26,6 +26,10 @@
'help' => 'Run the daemon as the current user '.
'instead of the configured phd.user',
),
+ array(
+ 'name' => 'autoscale',
+ 'help' => pht('Put the daemon in an autoscale group.'),
+ ),
));
}
@@ -38,10 +42,20 @@
pht('You must specify which daemon to debug.'));
}
- $daemon_class = array_shift($argv);
+ $config = array();
+
+ $config['class'] = array_shift($argv);
+ $config['argv'] = $argv;
+
+ if ($args->getArg('autoscale')) {
+ $config['autoscale'] = array(
+ 'group' => 'debug',
+ );
+ }
+
return $this->launchDaemons(
array(
- array($daemon_class, $argv),
+ $config,
),
$is_debug = true,
$run_as_current_user);
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementLaunchWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementLaunchWorkflow.php
--- a/src/applications/daemon/management/PhabricatorDaemonManagementLaunchWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementLaunchWorkflow.php
@@ -43,7 +43,10 @@
pht('You must specify which daemon to launch.'));
}
- $daemon = array(array_shift($argv), $argv);
+ $daemon = array();
+ $daemon['class'] = array_shift($argv);
+ $daemon['argv'] = $argv;
+
$daemons = array_fill(0, $daemon_count, $daemon);
$this->launchDaemons($daemons, $is_debug = false);
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
--- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
@@ -113,8 +113,8 @@
// Convert any shorthand classnames like "taskmaster" into proper class
// names.
foreach ($daemons as $key => $daemon) {
- $class = $this->findDaemonClass($daemon[0]);
- $daemons[$key][0] = $class;
+ $class = $this->findDaemonClass($daemon['class']);
+ $daemons[$key]['class'] = $class;
}
$console = PhutilConsole::getConsole();
@@ -176,15 +176,7 @@
Filesystem::assertWritable($pid_dir);
$config['piddir'] = $pid_dir;
-
- $config['daemons'] = array();
- foreach ($daemons as $daemon) {
- list($class, $argv) = $daemon;
- $config['daemons'][] = array(
- 'class' => $class,
- 'argv' => $argv,
- );
- }
+ $config['daemons'] = $daemons;
$command = csprintf('./phd-daemon %Ls', $flags);
@@ -327,14 +319,22 @@
}
$daemons = array(
- array('PhabricatorRepositoryPullLocalDaemon', array()),
- array('PhabricatorGarbageCollectorDaemon', array()),
- array('PhabricatorTriggerDaemon', array()),
+ array(
+ 'class' => 'PhabricatorRepositoryPullLocalDaemon',
+ ),
+ array(
+ 'class' => 'PhabricatorGarbageCollectorDaemon',
+ ),
+ array(
+ 'class' => 'PhabricatorTriggerDaemon',
+ ),
);
$taskmasters = PhabricatorEnv::getEnvConfig('phd.start-taskmasters');
for ($ii = 0; $ii < $taskmasters; $ii++) {
- $daemons[] = array('PhabricatorTaskmasterDaemon', array());
+ $daemons[] = array(
+ 'class' => 'PhabricatorTaskmasterDaemon',
+ );
}
$this->launchDaemons($daemons, $is_debug = false);
@@ -568,8 +568,18 @@
pht('(Logs will appear in "%s".)', $log_dir));
foreach ($daemons as $daemon) {
- list($class, $argv) = $daemon;
- $console->writeOut(" %s %s\n", $class, implode(' ', $argv));
+ $is_autoscale = isset($daemon['autoscale']['group']);
+ if ($is_autoscale) {
+ $autoscale = pht('(Autoscaling)');
+ } else {
+ $autoscale = pht('(Static)');
+ }
+
+ $console->writeOut(
+ " %s %s\n",
+ $daemon['class'],
+ $autoscale,
+ implode(' ', idx($daemon, 'argv', array())));
}
$console->writeOut("\n");
}
diff --git a/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php b/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php
--- a/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php
+++ b/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php
@@ -12,6 +12,8 @@
->execute();
if ($tasks) {
+ $this->willBeginWork();
+
foreach ($tasks as $task) {
$id = $task->getID();
$class = $task->getTaskClass();
@@ -55,6 +57,7 @@
// The first time we sleep, we add a random offset to try to spread
// the sleep times out somewhat evenly.
+ $this->willBeginIdle();
$sleep = $taskmaster_count + $offset;
$offset = 0;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 5, 6:27 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6708669
Default Alt Text
D11860.id28571.diff (5 KB)
Attached To
Mode
D11860: Support autoscaling daemons in phd
Attached
Detach File
Event Timeline
Log In to Comment