SystemDaemon
class SystemDaemon extends SystemDaemonThreaded
Constants
| private THREAD_CONFIG_CHECK_INTERVAL |
|
Properties
| array | $cmd_params | from SystemDaemon | |
| $daemon_name | |||
| $module_name | |||
| mixed | $view | from SystemDaemon | |
| $sleep_between_process | |||
| int | $process_counter | from SystemDaemon | |
| mixed | $mod_registry | from SystemDaemon | |
| bool | $shutdown | from SystemDaemon | |
| string | $sleeping | from SystemDaemon | |
| array | $messages | from SystemDaemon | |
| protected float|int | $requestCacheClearingTime | from SystemDaemon | |
| protected int | $lastRequestCacheClearingTime | from SystemDaemon | |
| protected | $maxThreadCount | ||
| protected | $threadLifetimeCycles | from SystemDaemonThreaded | |
| protected JobQueueController | $mod | ||
| protected string[] | $queues | ||
| protected int | $maintenanceLastCheck | ||
| protected int | $maintenanceKeepHistoryDays |
Methods
Initialize Instances
Handle Logging of Fatal Errors and add Log-Entry to Job
Gets called if a thread finishes It can be used e.g. to clean up unfinished work in case of an ABORTED exit status
Gets calles before a Thread is being started Use this place to e.g. initialize/update static caches which can be reused in each thread to avoid init within each thread
Check for Maintenance Tasks
Called after a new Thread has been started. Is only called once per thread.
Calculate the number of threads we should currently use. If we have no open jobs we reduce the number of running threads to reduce system load. We scale threads dynamic to match workload.
Returns an array with all threads which should run and their options By default we use the configured number of Max Threads
Default Entry Point for each Thread which covers the basic abort checks and thread lifetime handling
Returns true if the daemon process is in the shutdown phase to be ended
Startup of Daemon (Fail all aborted jobs on this node)
Mark jobs as failed if a thread fails
Main Daemon Process used to orchestrate all working threads Important: Must not contain any blocking operations
Main Process Loop for each Thread to fetch and process each job. Called multiple times per thread.
Details
at line 41
__construct()
Initialize Instances
in
SystemDaemon at line 363
__destruct()
No description
at line 112
void
_threadShutdown()
Handle Logging of Fatal Errors and add Log-Entry to Job
in
SystemDaemonThreaded at line 225
void
afterThreadFinished(string $threadIdentifier, int $threadProcessId, int $exitStatus)
Gets called if a thread finishes It can be used e.g. to clean up unfinished work in case of an ABORTED exit status
in
SystemDaemonThreaded at line 213
void
beforeNewThreadStart(string $threadIdentifier, array $threadOptions)
Gets calles before a Thread is being started Use this place to e.g. initialize/update static caches which can be reused in each thread to avoid init within each thread
at line 150
void
beforeProcess()
Check for Maintenance Tasks
at line 71
beginThread()
Called after a new Thread has been started. Is only called once per thread.
in
SystemDaemonThreaded at line 38
endThread()
Gets called within a thread before stopping thread
at line 128
int
getRequiredThreadCount()
Calculate the number of threads we should currently use. If we have no open jobs we reduce the number of running threads to reduce system load. We scale threads dynamic to match workload.
in
SystemDaemonThreaded at line 183
array
getThreadConfig()
Returns an array with all threads which should run and their options By default we use the configured number of Max Threads
in
SystemDaemon at line 336
halt()
No description
in
SystemDaemonThreaded at line 60
final bool
handleProcessThread(string $threadIdentifier, array $threadOptions)
Default Entry Point for each Thread which covers the basic abort checks and thread lifetime handling
in
SystemDaemon at line 224
bool
isShutdown()
Returns true if the daemon process is in the shutdown phase to be ended
in
SystemDaemon at line 165
void
load_module_instances(mixed $module)
No description
in
SystemDaemon at line 313
message(string $message, string $level = Logger::INFO)
Daemon message
at line 59
onStartup()
Startup of Daemon (Fail all aborted jobs on this node)
at line 142
void
onThreadError(string $threadIdentifier, int $threadProcessId, int $exitStatus)
Mark jobs as failed if a thread fails
in
SystemDaemonThreaded at line 97
final
process()
Main Daemon Process used to orchestrate all working threads Important: Must not contain any blocking operations
at line 84
bool
processThread(string $threadIdentifier, array $threadOptions)
Main Process Loop for each Thread to fetch and process each job. Called multiple times per thread.
Being called by parent class logic to start a new thread
in
SystemDaemon at line 371
protected
registerSignalHandler()
No description
in
SystemDaemon at line 110
static
restart_all()
Restart all Daemons
in
SystemDaemon at line 386
signalHandler(int $signo, mixed $siginfo)
No description
in
SystemDaemon at line 183
start()
No description
in
SystemDaemon at line 125
static
start_all(bool $if_running_on_this_node = false)
Start all Daemons
in
SystemDaemon at line 145
static
stop_all(bool $if_running_on_this_node = false)
Stop all Daemons