Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14869092
D11857.id28617.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
D11857.id28617.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
@@ -39,9 +39,10 @@
}
$daemon_class = array_shift($argv);
- return $this->launchDaemon(
- $daemon_class,
- $argv,
+ return $this->launchDaemons(
+ array(
+ array($daemon_class, $argv),
+ ),
$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,13 +43,10 @@
pht('You must specify which daemon to launch.'));
}
- $daemon_class = array_shift($argv);
+ $daemon = array(array_shift($argv), $argv);
+ $daemons = array_fill(0, $daemon_count, $daemon);
- $this->willLaunchDaemons();
-
- for ($ii = 0; $ii < $daemon_count; $ii++) {
- $this->launchDaemon($daemon_class, $argv, $is_debug = false);
- }
+ $this->launchDaemons($daemons, $is_debug = false);
return 0;
}
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
@@ -105,13 +105,18 @@
return head($match);
}
- protected final function launchDaemon(
- $class,
- array $argv,
+ protected final function launchDaemons(
+ array $daemons,
$debug,
$run_as_current_user = false) {
- $daemon = $this->findDaemonClass($class);
+ // Convert any shorthand classnames like "taskmaster" into proper class
+ // names.
+ foreach ($daemons as $key => $daemon) {
+ $class = $this->findDaemonClass($daemon[0]);
+ $daemons[$key][0] = $class;
+ }
+
$console = PhutilConsole::getConsole();
if (!$run_as_current_user) {
@@ -136,34 +141,7 @@
}
}
- if ($debug) {
- if ($argv) {
- $console->writeOut(
- pht(
- "Launching daemon \"%s\" in debug mode (not daemonized) ".
- "with arguments %s.\n",
- $daemon,
- csprintf('%LR', $argv)));
- } else {
- $console->writeOut(
- pht(
- "Launching daemon \"%s\" in debug mode (not daemonized).\n",
- $daemon));
- }
- } else {
- if ($argv) {
- $console->writeOut(
- pht(
- "Launching daemon \"%s\" with arguments %s.\n",
- $daemon,
- csprintf('%LR', $argv)));
- } else {
- $console->writeOut(
- pht(
- "Launching daemon \"%s\".\n",
- $daemon));
- }
- }
+ $this->printLaunchingDaemons($daemons, $debug);
$flags = array();
if ($debug || PhabricatorEnv::getEnvConfig('phd.trace')) {
@@ -174,6 +152,12 @@
$flags[] = '--verbose';
}
+ $instance = PhabricatorEnv::getEnvConfig('cluster.instance');
+ if ($instance) {
+ $flags[] = '-l';
+ $flags[] = $instance;
+ }
+
$config = array();
if (!$debug) {
@@ -193,12 +177,14 @@
$config['piddir'] = $pid_dir;
- $config['daemons'] = array(
- array(
- 'class' => $daemon,
+ $config['daemons'] = array();
+ foreach ($daemons as $daemon) {
+ list($class, $argv) = $daemon;
+ $config['daemons'][] = array(
+ 'class' => $class,
'argv' => $argv,
- ),
- );
+ );
+ }
$command = csprintf('./phd-daemon %Ls', $flags);
@@ -304,14 +290,6 @@
}
}
- protected final function willLaunchDaemons() {
- $console = PhutilConsole::getConsole();
- $console->writeErr(pht('Preparing to launch daemons.')."\n");
-
- $log_dir = $this->getLogDirectory().'/daemons.log';
- $console->writeErr(pht("NOTE: Logs will appear in '%s'.", $log_dir)."\n\n");
- }
-
/* -( Commands )----------------------------------------------------------- */
@@ -359,12 +337,7 @@
$daemons[] = array('PhabricatorTaskmasterDaemon', array());
}
- $this->willLaunchDaemons();
-
- foreach ($daemons as $spec) {
- list($name, $argv) = $spec;
- $this->launchDaemon($name, $argv, $is_debug = false);
- }
+ $this->launchDaemons($daemons, $is_debug = false);
$console->writeErr(pht('Done.')."\n");
return 0;
@@ -579,4 +552,26 @@
return $conn_w->getAffectedRows();
}
+
+ private function printLaunchingDaemons(array $daemons, $debug) {
+ $console = PhutilConsole::getConsole();
+
+ if ($debug) {
+ $console->writeOut(pht('Launching daemons (in debug mode):'));
+ } else {
+ $console->writeOut(pht('Launching daemons:'));
+ }
+
+ $log_dir = $this->getLogDirectory().'/daemons.log';
+ $console->writeOut(
+ "\n%s\n\n",
+ pht('(Logs will appear in "%s".)', $log_dir));
+
+ foreach ($daemons as $daemon) {
+ list($class, $argv) = $daemon;
+ $console->writeOut(" %s %s\n", $class, implode(' ', $argv));
+ }
+ $console->writeOut("\n");
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 9, 2:41 AM (20 h, 48 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7104148
Default Alt Text
D11857.id28617.diff (5 KB)
Attached To
Mode
D11857: Start all daemons under a single overseer
Attached
Detach File
Event Timeline
Log In to Comment