MediaWiki REL1_35
|
Job queue runner utility methods. More...
Public Member Functions | |
__construct ( $serviceOptions=null, ILBFactory $lbFactory=null, JobQueueGroup $jobQueueGroup=null, ReadOnlyMode $readOnlyMode=null, LinkCache $linkCache=null, StatsdDataFactoryInterface $statsdDataFactory=null, LoggerInterface $logger=null) | |
Calling this directly is deprecated. | |
executeJob (RunnableJob $job) | |
Run a specific job in a manner appropriate for mass use by job dispatchers. | |
run (array $options) | |
Run jobs of the specified number/type for the specified time. | |
setDebugHandler ( $debug) | |
setLogger (LoggerInterface $logger) | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
Private Member Functions | |
checkMemoryOK () | |
Make sure that this script is not too close to the memory usage limit. | |
commitMasterChanges (RunnableJob $job, $fnameTrxOwner) | |
Issue a commit on all masters who are currently in a transaction and have made changes to the database. | |
debugCallback ( $msg) | |
Log the job message. | |
doExecuteJob (RunnableJob $job) | |
getBackoffTimeToWait (RunnableJob $job) | |
getErrorBackoffTTL (array $caught) | |
getMaxRssKb () | |
loadBackoffs (array $backoffs, $mode='wait') | |
Get the previous backoff expiries from persistent storage On I/O or lock acquisition failure this returns the original $backoffs. | |
syncBackoffDeltas (array $backoffs, array &$deltas, $mode='wait') | |
Merge the current backoff expiries from persistent storage. | |
Private Attributes | |
callable null | $debug |
Debug output handler. | |
JobQueueGroup | $jobQueueGroup |
ILBFactory | $lbFactory |
LinkCache | $linkCache |
LoggerInterface | $logger |
ServiceOptions | $options |
ReadOnlyMode | $readOnlyMode |
StatsdDataFactoryInterface | $stats |
JobRunner::__construct | ( | $serviceOptions = null , |
|
ILBFactory | $lbFactory = null , |
||
JobQueueGroup | $jobQueueGroup = null , |
||
ReadOnlyMode | $readOnlyMode = null , |
||
LinkCache | $linkCache = null , |
||
StatsdDataFactoryInterface | $statsdDataFactory = null , |
||
LoggerInterface | $logger = null |
||
) |
Calling this directly is deprecated.
Obtain an instance via MediaWikiServices instead.
ServiceOptions | LoggerInterface | null | $serviceOptions | |
ILBFactory | null | $lbFactory | |
JobQueueGroup | null | $jobQueueGroup | The JobQueueGroup for this wiki |
ReadOnlyMode | null | $readOnlyMode | |
LinkCache | null | $linkCache | |
StatsdDataFactoryInterface | null | $statsdDataFactory | |
LoggerInterface | null | $logger |
Definition at line 114 of file JobRunner.php.
References $jobQueueGroup, $lbFactory, $linkCache, $logger, and $readOnlyMode.
|
private |
Make sure that this script is not too close to the memory usage limit.
It is better to die in between jobs than OOM right in the middle of one.
Definition at line 576 of file JobRunner.php.
References debugCallback().
Referenced by run().
|
private |
Issue a commit on all masters who are currently in a transaction and have made changes to the database.
It also supports sometimes waiting for the local wiki's replica DBs to catch up. See the documentation for $wgJobSerialCommitThreshold for more.
RunnableJob | $job | |
string | $fnameTrxOwner |
DBError |
Definition at line 625 of file JobRunner.php.
References $job, and debugCallback().
Referenced by doExecuteJob().
|
private |
Log the job message.
string | $msg | The message to log |
Definition at line 609 of file JobRunner.php.
References wfTimestamp().
Referenced by checkMemoryOK(), commitMasterChanges(), and doExecuteJob().
|
private |
RunnableJob | $job |
Definition at line 348 of file JobRunner.php.
References $job, commitMasterChanges(), debugCallback(), getMaxRssKb(), and wfTimestamp().
Referenced by executeJob().
JobRunner::executeJob | ( | RunnableJob | $job | ) |
Run a specific job in a manner appropriate for mass use by job dispatchers.
Wraps the job's run() and tearDown() methods into appropriate transaction rounds. During execution, SPI-based logging will use the ID of the HTTP request that spawned the job (instead of the current one). Large DB write transactions will be subject to $wgJobSerialCommitThreshold and $wgMaxJobDBWriteDuration.
This should never be called if there are explicit transaction rounds or pending DB writes
RunnableJob | $job |
Definition at line 326 of file JobRunner.php.
References $job, and doExecuteJob().
Referenced by run().
|
private |
RunnableJob | $job |
Definition at line 467 of file JobRunner.php.
References $job.
Referenced by run().
|
private |
string[] | $caught | List of FQCNs corresponding to any exceptions caught |
Definition at line 447 of file JobRunner.php.
Referenced by run().
|
private |
Definition at line 456 of file JobRunner.php.
Referenced by doExecuteJob().
|
private |
Get the previous backoff expiries from persistent storage On I/O or lock acquisition failure this returns the original $backoffs.
array | $backoffs | Map of (job type => UNIX timestamp) |
string | $mode | Lock wait mode - "wait" or "nowait" |
Definition at line 499 of file JobRunner.php.
References $content, $file, $type, and wfTempDir().
Referenced by syncBackoffDeltas().
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:
This method outputs status information only if a debug handler was set. Any exceptions are caught and logged, but are not reported as output.
array | $options | Map of parameters:
|
JobQueueError |
Definition at line 166 of file JobRunner.php.
References $job, $type, checkMemoryOK(), executeJob(), getBackoffTimeToWait(), getErrorBackoffTTL(), and syncBackoffDeltas().
JobRunner::setDebugHandler | ( | $debug | ) |
callable | $debug | Optional debug output handler |
Definition at line 89 of file JobRunner.php.
References $debug.
JobRunner::setLogger | ( | LoggerInterface | $logger | ) |
LoggerInterface | $logger |
Definition at line 98 of file JobRunner.php.
References wfDeprecated().
|
private |
Merge the current backoff expiries from persistent storage.
The $deltas map is set to an empty array on success. On I/O or lock acquisition failure this returns the original $backoffs.
array | $backoffs | Map of (job type => UNIX timestamp) |
array | &$deltas | Map of (job type => seconds) |
string | $mode | Lock wait mode - "wait" or "nowait" |
Definition at line 536 of file JobRunner.php.
References $content, $file, $type, loadBackoffs(), and wfTempDir().
Referenced by run().
|
private |
Debug output handler.
Definition at line 70 of file JobRunner.php.
|
private |
Definition at line 58 of file JobRunner.php.
Referenced by __construct().
|
private |
Definition at line 55 of file JobRunner.php.
Referenced by __construct().
|
private |
Definition at line 64 of file JobRunner.php.
Referenced by __construct().
|
private |
Definition at line 73 of file JobRunner.php.
Referenced by __construct().
|
private |
Definition at line 52 of file JobRunner.php.
|
private |
Definition at line 61 of file JobRunner.php.
Referenced by __construct().
|
private |
Definition at line 67 of file JobRunner.php.
const JobRunner::CONSTRUCTOR_OPTIONS |
Definition at line 43 of file JobRunner.php.