MasterSupervisor
class MasterSupervisor implements Pausable, Restartable, Terminable
Traits
Properties
| protected array | $pendingSignals | The pending signals that need to be processed. |
from ListensForSignals |
| string | $name | The name of the master supervisor. |
|
| SupervisorProcess> | $supervisors | All of the supervisors managed. |
|
| bool | $working | Indicates if the master supervisor process is working. |
|
| Closure|null | $output | The output handler. |
|
| static Closure|null | $nameResolver | The callback to use to resolve master supervisor names. |
|
| static protected string|null | $token | The random token appended to the master supervisor name. |
|
| protected int|null | $exitStatus | The terminal exit status for this master supervisor. |
Methods
Create a new master supervisor instance.
Get the name for this master supervisor.
Get the basename for the machine's master supervisors.
Terminate all current supervisors and start fresh ones.
Pause the supervisors.
Instruct the supervisors to continue working.
Terminate this master supervisor and all of its supervisors.
Monitor the worker processes.
Ensure that this is the only master supervisor running for this machine.
Perform a monitor loop.
Handle any pending commands for the master supervisor.
"Monitor" all of the supervisors.
Persist information about the master supervisor instance.
Get the process ID for this supervisor.
Get the current memory usage (in megabytes).
Get the name of the command queue for the master supervisor.
Get the name of the command queue for the given master supervisor.
Handle the given output.
Flush all static state.
Details
in
ListensForSignals at line 26
protected void
listenForSignals()
Listen for incoming process signals.
in
ListensForSignals at line 54
protected void
processPendingSignals()
Process the pending signals.
at line 69
__construct(string|null $environment = null)
Create a new master supervisor instance.
at line 84
static string
name()
Get the name for this master supervisor.
at line 96
static string
basename()
Get the basename for the machine's master supervisors.
at line 109
static void
determineNameUsing(Closure $callback)
Use the given callback to resolve master supervisor names.
Boot-only. The resolver persists in a static property for the worker lifetime and runs on every master-name lookup.
at line 117
void
restart()
Terminate all current supervisors and start fresh ones.
at line 127
void
pause()
Pause the supervisors.
at line 137
void
continue()
Instruct the supervisors to continue working.
at line 147
void
terminate(int $status = 0)
Terminate this master supervisor and all of its supervisors.
at line 193
int
monitor()
Monitor the worker processes.
at line 217
void
ensureNoOtherMasterSupervisors()
Ensure that this is the only master supervisor running for this machine.
at line 227
void
loop()
Perform a monitor loop.
at line 253
protected void
processPendingCommands()
Handle any pending commands for the master supervisor.
at line 267
protected void
monitorSupervisors()
"Monitor" all of the supervisors.
at line 279
void
persist()
Persist information about the master supervisor instance.
at line 287
int
pid()
Get the process ID for this supervisor.
at line 295
float
memoryUsage()
Get the current memory usage (in megabytes).
at line 303
static string
commandQueue()
Get the name of the command queue for the master supervisor.
at line 311
static string
commandQueueFor(string|null $name = null)
Get the name of the command queue for the given master supervisor.
at line 321
MasterSupervisor
handleOutputUsing(Closure $callback)
Set the output handler.
at line 331
void
output(string $type, string $line)
Handle the given output.
at line 339
static void
flushState()
Flush all static state.