Google Cloud PHP shared dependency, providing functionality useful to all components. Client - Class BatchJob (1.73.5)

Reference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class BatchJob.

Represent batch jobs.

Namespace

Google \ Cloud \ Core \ Batch

Implements

Methods

__construct

Parameters
Name Description
identifier string

Unique identifier of the job.

func callable

Any Callable except for Closure. The callable should accept an array of items as the first argument.

idNum int

A numeric id for the job.

options array

Configuration options.

↳ batchSize int

The size of the batch. Defaults to 100.

↳ callPeriod float

The period in seconds from the last execution to force executing the job. Defaults to 2.0.

↳ numWorkers int

The number of child processes. It only takes effect with the BatchDaemon. Defaults to 1.

↳ bootstrapFile string

A file to load before executing the job. It's needed for registering global functions.

run

Run the job.

flush

Finish any pending activity for this job.

Parameter
Name Description
items array
Returns
Type Description
bool

callFunc

Finish any pending activity for this job.

Parameter
Name Description
items array
Returns
Type Description
bool

getCallPeriod

Returns the period in seconds from the last execution to force executing the job.

Returns
Type Description
float

getBatchSize

Returns the batch size.

Returns
Type Description
int

drainOversizedMessage

Drain an oversized message from the queue to prevent head-of-line blocking.

Parameters
Name Description
q resource

The message queue resource.

maxSize int

The max buffer size to receive.

Returns
Type Description
bool

isMsgTooBig

Check if the error code from msg_receive indicates that the message was too big.

Parameter
Name Description
errorcode int
Returns
Type Description
bool

Constants

DEFAULT_BATCH_SIZE

Value: 100

DEFAULT_CALL_PERIOD

Value: 2.0

DEFAULT_WORKERS

Value: 1

MAX_MESSAGE_SIZE

Value: 8192