class SupervisorOptions

Properties

string|null $queue

The queue that should be utilized.

bool $autoScale

Indicates if the supervisor should auto-scale.

string|null $directory

The working directories that new workers should be started from.

int $retryAfter

The number of seconds to wait before retrying a job that encountered an uncaught exception.

Methods

__construct(string $name, string $connection, string|null $queue = null, string $workersName = 'default', bool|string $balance = 'off', int|string $backoff = 0, int $maxTime = 0, int $maxJobs = 0, int $maxProcesses = 1, int $minProcesses = 1, int $concurrency = 1, int $memory = 128, int $timeout = 60, int $sleep = 3, int $maxTries = 0, bool $force = false, int $nice = 0, int $balanceCooldown = 3, int $balanceMaxShift = 1, int $parentId = 0, int $rest = 0, string|null $autoScalingStrategy = 'time')

Create a new worker options instance.

withQueue(string $queue)

Create a fresh options instance with the given queue.

bool
balancing()

Determine if a balancing strategy should be used.

bool
autoScaling()

Determine if auto-scaling should be applied.

bool
autoScaleByNumberOfJobs()

Determine if auto-scaling should be based on the number of jobs on the queue instead of time-to-clear.

string
toSupervisorCommand()

Get the command-line representation of the options for a supervisor.

string
toWorkerCommand()

Get the command-line representation of the options for a worker.

string
toJson()

Convert the options to a JSON string.

array
toArray()

Convert the options to a raw array.

fromArray(array $array)

Create a new options instance from the given array.

Details

at line 53
__construct(string $name, string $connection, string|null $queue = null, string $workersName = 'default', bool|string $balance = 'off', int|string $backoff = 0, int $maxTime = 0, int $maxJobs = 0, int $maxProcesses = 1, int $minProcesses = 1, int $concurrency = 1, int $memory = 128, int $timeout = 60, int $sleep = 3, int $maxTries = 0, bool $force = false, int $nice = 0, int $balanceCooldown = 3, int $balanceMaxShift = 1, int $parentId = 0, int $rest = 0, string|null $autoScalingStrategy = 'time')

Create a new worker options instance.

Parameters

string $name

the name of the supervisor

string $connection

the queue connection that should be utilized

string|null $queue
string $workersName

the name of the workers

bool|string $balance

indicates the balancing strategy the supervisor should use

int|string $backoff

the number of seconds to wait before retrying a job that encountered an uncaught exception

int $maxTime

the maximum number of seconds a worker may live

int $maxJobs

the maximum number of jobs to run

int $maxProcesses

the maximum number of total processes to start when auto-scaling

int $minProcesses

the minimum number of processes to assign per working when auto-scaling

int $concurrency
int $memory

the maximum amount of RAM the worker may consume

int $timeout

the maximum number of seconds a child worker may run

int $sleep

the number of seconds to wait in between polling the queue

int $maxTries

the maximum amount of times a job may be attempted

bool $force

indicates if the worker should run in maintenance mode

int $nice

the process priority

int $balanceCooldown

the number of seconds to wait in between auto-scaling attempts

int $balanceMaxShift

the maximum number of processes to increase or decrease per one scaling

int $parentId

the parent process identifier

int $rest

the number of seconds to rest between jobs

string|null $autoScalingStrategy

indicates whether auto-scaling strategy should use "time" (time-to-complete) or "size" (total count of jobs) strategies

at line 85
SupervisorOptions withQueue(string $queue)

Create a fresh options instance with the given queue.

Parameters

string $queue

Return Value

SupervisorOptions

at line 95
bool balancing()

Determine if a balancing strategy should be used.

Return Value

bool

at line 103
bool autoScaling()

Determine if auto-scaling should be applied.

Return Value

bool

at line 111
bool autoScaleByNumberOfJobs()

Determine if auto-scaling should be based on the number of jobs on the queue instead of time-to-clear.

Return Value

bool

at line 119
string toSupervisorCommand()

Get the command-line representation of the options for a supervisor.

Return Value

string

at line 127
string toWorkerCommand()

Get the command-line representation of the options for a worker.

Return Value

string

at line 135
string toJson()

Convert the options to a JSON string.

Return Value

string

at line 143
array toArray()

Convert the options to a raw array.

Return Value

array

at line 174
static SupervisorOptions fromArray(array $array)

Create a new options instance from the given array.

Parameters

array $array

Return Value

SupervisorOptions