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 $memory = 128, int $timeout = 60, float $sleep = 3, int $maxTries = 0, bool $force = false, int $nice = 0, int $balanceCooldown = 3, int $balanceMaxShift = 1, int $parentId = 0, float $rest = 0, string|null $autoScalingStrategy = 'time', bool $json = false, int $concurrency = 1)

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.

bool
autoScaleLogarithmically()

Determine if auto-scaling should use logarithmic queue sizes.

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 55
__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 $memory = 128, int $timeout = 60, float $sleep = 3, int $maxTries = 0, bool $force = false, int $nice = 0, int $balanceCooldown = 3, int $balanceMaxShift = 1, int $parentId = 0, float $rest = 0, string|null $autoScalingStrategy = 'time', bool $json = false, int $concurrency = 1)

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 $memory

the maximum amount of RAM the worker may consume

int $timeout

the maximum number of seconds a child worker may run

float $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

float $rest

the number of seconds to rest between jobs

string|null $autoScalingStrategy

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

bool $json

indicates if the workers should output their information as JSON

int $concurrency

the number of jobs each worker process may run at once

at line 88
SupervisorOptions withQueue(string $queue)

Create a fresh options instance with the given queue.

Parameters

string $queue

Return Value

SupervisorOptions

at line 98
bool balancing()

Determine if a balancing strategy should be used.

Return Value

bool

at line 106
bool autoScaling()

Determine if auto-scaling should be applied.

Return Value

bool

at line 114
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 122
bool autoScaleLogarithmically()

Determine if auto-scaling should use logarithmic queue sizes.

Return Value

bool

at line 130
string toSupervisorCommand()

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

Return Value

string

at line 138
string toWorkerCommand()

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

Return Value

string

at line 146
string toJson()

Convert the options to a JSON string.

Return Value

string

at line 154
array toArray()

Convert the options to a raw array.

Return Value

array

at line 186
static SupervisorOptions fromArray(array $array)

Create a new options instance from the given array.

Parameters

array $array

Return Value

SupervisorOptions