mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 05:42:40 +01:00
Add a --force command to phd start
Summary: Ref T7352. This isn't wildly useful for us but seems generally reasonable, can be helpful with testing, and @hach-que has a use case for it. The only reason we issue this warning is to prevent user error; you can still launch all the daemons with `phd launch` manually and daemons all use locks to protect critical regions. Test Plan: Ran `phd start --force` a bunch, saw zillions of daemons. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley, hach-que Maniphest Tasks: T7352 Differential Revision: https://secure.phabricator.com/D11861
This commit is contained in:
parent
48fc3126a1
commit
ef22fe1e74
2 changed files with 26 additions and 16 deletions
|
@ -19,11 +19,18 @@ final class PhabricatorDaemonManagementStartWorkflow
|
|||
'By default, **phd start** will free all task leases held by '.
|
||||
'the daemons. With this flag, this step will be skipped.'),
|
||||
),
|
||||
array(
|
||||
'name' => 'force',
|
||||
'help' => pht(
|
||||
'Start daemons even if daemons are already running.'),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
return $this->executeStartCommand($args->getArg('keep-leases'));
|
||||
return $this->executeStartCommand(
|
||||
$args->getArg('keep-leases'),
|
||||
$args->getArg('force'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -286,9 +286,10 @@ abstract class PhabricatorDaemonManagementWorkflow
|
|||
/* -( Commands )----------------------------------------------------------- */
|
||||
|
||||
|
||||
protected final function executeStartCommand($keep_leases = false) {
|
||||
protected final function executeStartCommand($keep_leases, $force) {
|
||||
$console = PhutilConsole::getConsole();
|
||||
|
||||
if (!$force) {
|
||||
$running = $this->loadRunningDaemons();
|
||||
|
||||
// This may include daemons which were launched but which are no longer
|
||||
|
@ -297,16 +298,18 @@ abstract class PhabricatorDaemonManagementWorkflow
|
|||
if ($daemon->isRunning()) {
|
||||
$message = pht(
|
||||
"phd start: Unable to start daemons because daemons are already ".
|
||||
"running.\n".
|
||||
"running.\n\n".
|
||||
"You can view running daemons with 'phd status'.\n".
|
||||
"You can stop running daemons with 'phd stop'.\n".
|
||||
"You can use 'phd restart' to stop all daemons before starting new ".
|
||||
"daemons.");
|
||||
"You can use 'phd restart' to stop all daemons before starting ".
|
||||
"new daemons.\n".
|
||||
"You can force daemons to start anyway with --force.");
|
||||
|
||||
$console->writeErr("%s\n", $message);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($keep_leases) {
|
||||
$console->writeErr("%s\n", pht('Not touching active task queue leases.'));
|
||||
|
|
Loading…
Reference in a new issue