BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
JobRunner Class Reference
Inheritance diagram for JobRunner:
Collaboration diagram for JobRunner:

Public Member Functions

 setDebugHandler ($debug)
 
 setLogger (LoggerInterface $logger)
 
 __construct (LoggerInterface $logger=null)
 
 run (array $options)
 

Public Attributes

const MAX_ALLOWED_LAG = 3
 
const LAG_CHECK_PERIOD = 1.0
 
const ERROR_BACKOFF_TTL = 1
 
const READONLY_BACKOFF_TTL = 30
 

Protected Attributes

 $config
 
 $debug
 
 $logger
 

Detailed Description

Job queue runner utility methods

Since
1.24

Constructor & Destructor Documentation

JobRunner::__construct ( LoggerInterface  $logger = null)
Parameters
LoggerInterface$logger

Member Function Documentation

JobRunner::run ( array  $options)

Run jobs of the specified number/type for the specified time

The response map has a 'job' field that lists status of each job, including:

  • type : the job type
  • status : ok/failed
  • error : any error message string
  • time : the job run time in ms The response map also has:
  • backoffs : the (job type => seconds) map of backoff times
  • elapsed : the total time spent running tasks in ms
  • reached : the reason the script finished, one of (none-ready, job-limit, time-limit, memory-limit)

This method outputs status information only if a debug handler was set. Any exceptions are caught and logged, but are not reported as output.

Parameters
array$optionsMap of parameters:
  • type : the job type (or false for the default types)
  • maxJobs : maximum number of jobs to run
  • maxTime : maximum time in seconds before stopping
  • throttle : whether to respect job backoff configuration
Returns
array Summary response that can easily be JSON serialized
JobRunner::setDebugHandler (   $debug)
Parameters
callable$debugOptional debug output handler
JobRunner::setLogger ( LoggerInterface  $logger)
Parameters
LoggerInterface$logger
Returns
void

Implements Psr\Log\LoggerAwareInterface.


The documentation for this class was generated from the following file: