PHP Class Scalr\System\Zmq\Cron\Launcher

Since: 5.0.1 (15.09.2014)
Author: Vitaliy Demidov ([email protected])
Inheritance: use trait Scalr\LoggerAwareTrait
显示文件 Open project: scalr/scalr Class Usage Examples

Public Methods

Method Description
__construct ( DateTime $start ) Constructor
ensureBrokerRunning ( ) : integer Makes sure the broker is running.
getAllTasks ( ) : Scalr\System\Zmq\Cron\ServiceIterator Gets the list of all tasks
getScheduled ( ) : Scalr\System\Zmq\Cron\ScheduledServiceIterator Gets the list of the tasks which are due to run
getStartBrokerCommand ( ) : string Gets start broker command
getStartClientCommand ( ) : string Gets start client command
getStartPhpScriptCommand ( string $script ) : string Gets start php script command
getStartWorkerCommand ( ) : string Gets start worker command
healthcheck ( ) Performs health chek
launch ( ) : integer Launches tasks are due to run
terminateBroker ( ) Terminates broker
terminateByFilter ( string $cmd, string $gracefully = true ) Gracefully terminates processes by start command key
terminateClients ( ) Terminates all clients

Method Details

__construct() public method

Constructor
public __construct ( DateTime $start )
$start DateTime Start time in system timezone

ensureBrokerRunning() public static method

If it isn't running method will start it.
public static ensureBrokerRunning ( ) : integer
return integer Returns non false if broker is running

getAllTasks() public method

Gets the list of all tasks
public getAllTasks ( ) : Scalr\System\Zmq\Cron\ServiceIterator
return Scalr\System\Zmq\Cron\ServiceIterator

getScheduled() public method

Gets the list of the tasks which are due to run
public getScheduled ( ) : Scalr\System\Zmq\Cron\ScheduledServiceIterator
return Scalr\System\Zmq\Cron\ScheduledServiceIterator

getStartBrokerCommand() public static method

Gets start broker command
public static getStartBrokerCommand ( ) : string
return string Returns start broker cmd

getStartClientCommand() public static method

Gets start client command
public static getStartClientCommand ( ) : string
return string Returns start client cmd

getStartPhpScriptCommand() public static method

Gets start php script command
public static getStartPhpScriptCommand ( string $script ) : string
$script string relative path from app folder
return string Returns start php script CMD

getStartWorkerCommand() public static method

Gets start worker command
public static getStartWorkerCommand ( ) : string
return string Returns start worker cmd

healthcheck() public static method

Performs health chek
public static healthcheck ( )

launch() public method

Launches tasks are due to run
public launch ( ) : integer
return integer Returns the number of the launched tasks

terminateBroker() public static method

Terminates broker
public static terminateBroker ( )

terminateByFilter() public static method

Gracefully terminates processes by start command key
public static terminateByFilter ( string $cmd, string $gracefully = true )
$cmd string CMD used as the start
$gracefully string optional Whether it should send SIGTERM rather than kill -9 forcefully

terminateClients() public static method

Terminates all clients
public static terminateClients ( )