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 \ BatchMethods
__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 |
↳ callPeriod |
float
The period in seconds from the last execution to force executing the job. Defaults to |
↳ numWorkers |
int
The number of child processes. It only takes effect with the BatchDaemon. Defaults to |
↳ 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 |
Constants
DEFAULT_BATCH_SIZE
Value: 100
DEFAULT_CALL_PERIOD
Value: 2.0
DEFAULT_WORKERS
Value: 1