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

void
listenForSignals()

Listen for incoming process signals.

void
processPendingSignals()

Process the pending signals.

__construct(string|null $environment = null)

Create a new master supervisor instance.

static string
name()

Get the name for this master supervisor.

static string
basename()

Get the basename for the machine's master supervisors.

static void
determineNameUsing(Closure $callback)

Use the given callback to resolve master supervisor names.

void
restart()

Terminate all current supervisors and start fresh ones.

void
pause()

Pause the supervisors.

void
continue()

Instruct the supervisors to continue working.

void
terminate(int $status = 0)

Terminate this master supervisor and all of its supervisors.

int
monitor()

Monitor the worker processes.

void
ensureNoOtherMasterSupervisors()

Ensure that this is the only master supervisor running for this machine.

void
loop()

Perform a monitor loop.

void
processPendingCommands()

Handle any pending commands for the master supervisor.

void
monitorSupervisors()

"Monitor" all of the supervisors.

void
persist()

Persist information about the master supervisor instance.

int
pid()

Get the process ID for this supervisor.

float
memoryUsage()

Get the current memory usage (in megabytes).

static string
commandQueue()

Get the name of the command queue for the master supervisor.

static string
commandQueueFor(string|null $name = null)

Get the name of the command queue for the given master supervisor.

handleOutputUsing(Closure $callback)

Set the output handler.

void
output(string $type, string $line)

Handle the given output.

static void
flushState()

Flush all static state.

Details

in ListensForSignals at line 26
protected void listenForSignals()

Listen for incoming process signals.

Return Value

void

in ListensForSignals at line 54
protected void processPendingSignals()

Process the pending signals.

Return Value

void

at line 69
__construct(string|null $environment = null)

Create a new master supervisor instance.

Parameters

string|null $environment

the environment that was used to provision this master supervisor

at line 84
static string name()

Get the name for this master supervisor.

Return Value

string

at line 96
static string basename()

Get the basename for the machine's master supervisors.

Return Value

string

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.

Parameters

Closure $callback

Return Value

void

at line 117
void restart()

Terminate all current supervisors and start fresh ones.

Return Value

void

at line 127
void pause()

Pause the supervisors.

Return Value

void

at line 137
void continue()

Instruct the supervisors to continue working.

Return Value

void

at line 147
void terminate(int $status = 0)

Terminate this master supervisor and all of its supervisors.

Parameters

int $status

Return Value

void

at line 193
int monitor()

Monitor the worker processes.

Return Value

int

at line 217
void ensureNoOtherMasterSupervisors()

Ensure that this is the only master supervisor running for this machine.

Return Value

void

Exceptions

Exception

at line 227
void loop()

Perform a monitor loop.

Return Value

void

at line 253
protected void processPendingCommands()

Handle any pending commands for the master supervisor.

Return Value

void

at line 267
protected void monitorSupervisors()

"Monitor" all of the supervisors.

Return Value

void

at line 279
void persist()

Persist information about the master supervisor instance.

Return Value

void

at line 287
int pid()

Get the process ID for this supervisor.

Return Value

int

at line 295
float memoryUsage()

Get the current memory usage (in megabytes).

Return Value

float

at line 303
static string commandQueue()

Get the name of the command queue for the master supervisor.

Return Value

string

at line 311
static string commandQueueFor(string|null $name = null)

Get the name of the command queue for the given master supervisor.

Parameters

string|null $name

Return Value

string

at line 321
MasterSupervisor handleOutputUsing(Closure $callback)

Set the output handler.

Parameters

Closure $callback

Return Value

MasterSupervisor

at line 331
void output(string $type, string $line)

Handle the given output.

Parameters

string $type
string $line

Return Value

void

at line 339
static void flushState()

Flush all static state.

Return Value

void