Represent batch jobs.

  • experimental The experimental flag means that while we believe this method or class is ready for use, it may change before release in backwards- incompatible ways. Please use with caution, and test thoroughly when upgrading.
public Google\Cloud\Core\Batch\BatchJob::DEFAULT_BATCH_SIZE = 100
public Google\Cloud\Core\Batch\BatchJob::DEFAULT_CALL_PERIOD = 2
public Google\Cloud\Core\Batch\BatchJob::DEFAULT_WORKERS = 1
public __construct( $identifier, $func, $idNum, array $options = [])
    public bootstrapFile()

    Returns the optional file required to run this job.

    • return string|null
    public callFunc(array $items = [])

    Finish any pending activity for this job.

    • access private
    • internal
    • return bool
    public flush(array $items = [])

    Finish any pending activity for this job.

    • return bool
    public getBatchSize()

    Returns the batch size.

    • return int
    public getCallPeriod()

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

    • return float
    public handleFailure( $idNum, array $items)

    Save the items to the failureFile. We silently abandon the items upon
    failures in this method because there's nothing we can do.

      public id()

      Return the job id

      • return int
      public identifier()

      Return the job identifier

      • return string
      public numWorkers()

      Returns the number of workers for this job. **Defaults to* 1.

      • return int
      public run()

      Run the job.

      public sigHandler( $signo, $siginfo = NULL)

      A signal handler for setting the terminate switch.

      • return void
      private $baseDir
      • var string Base directory for the failure files.
      private $batchSize
      • var int The size of the batch.
      private $bootstrapFile
      • var string|null An optional file that is required to run this job.
      private $callPeriod
      • var float The period in seconds from the last execution to force executing the job.
      private $failureFile
      • var string A filename to save the failed items.
      private $func
      • var callable The batch job handler. This callable accepts an array of items and should return a boolean.
      private $id
      • var int The job id
      private $identifier
      • var string The job identifier
      private $numWorkers
      • var int The number of workers for this job.
      private static $productionKey = 'P'
      private $shutdown
      private static $typeDirect = 1
      private static $typeFile = 2
      private getFailedFiles()

      Get all the filenames for the failure files.

      • return array Filenames for all the failure files.
      private getSysvKey( $idNum)

      Create a SystemV IPC key for the given id number.

      Set GOOGLE_CLOUD_SYSV_ID envvar to change the base id.

      • return int
      private initFailureFile()

      Determine the failureFile.

      private isSysvIPCLoaded()

      Determine whether the SystemV IPC extension family is loaded.

      • return bool
      private setupSignalHandlers()
      private static $productionKey = 'P'
      private static $typeDirect = 1
      private static $typeFile = 2
      © 2020 Bruce Wells
      Search Namespaces \ Classes
      ConfigurationNumbers (0-9.) only