Changeset View
Changeset View
Standalone View
Standalone View
scripts/daemon/exec/exec_daemon.php
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
$config = id(new PhutilJSONParser())->parse($config); | $config = id(new PhutilJSONParser())->parse($config); | ||||
PhutilTypeSpec::checkMap( | PhutilTypeSpec::checkMap( | ||||
$config, | $config, | ||||
array( | array( | ||||
'log' => 'optional string|null', | 'log' => 'optional string|null', | ||||
'argv' => 'optional list<wild>', | 'argv' => 'optional list<wild>', | ||||
'load' => 'optional list<string>', | 'load' => 'optional list<string>', | ||||
'autoscale' => 'optional wild', | 'down' => 'optional int', | ||||
)); | )); | ||||
$log = idx($config, 'log'); | $log = idx($config, 'log'); | ||||
if ($log) { | if ($log) { | ||||
ini_set('error_log', $log); | ini_set('error_log', $log); | ||||
PhutilErrorHandler::setErrorListener(array('PhutilDaemon', 'errorListener')); | PhutilErrorHandler::setErrorListener(array('PhutilDaemon', 'errorListener')); | ||||
} | } | ||||
Show All 39 Lines | |||||
if ($trace_memory) { | if ($trace_memory) { | ||||
$daemon->setTraceMemory(); | $daemon->setTraceMemory(); | ||||
} | } | ||||
if ($verbose) { | if ($verbose) { | ||||
$daemon->setVerbose(true); | $daemon->setVerbose(true); | ||||
} | } | ||||
$autoscale = idx($config, 'autoscale'); | $down_duration = idx($config, 'down'); | ||||
if ($autoscale) { | if ($down_duration) { | ||||
$daemon->setAutoscaleProperties($autoscale); | $daemon->setScaledownDuration($down_duration); | ||||
} | } | ||||
$daemon->execute(); | $daemon->execute(); |