MediaWiki REL1_39
RunnableJob Interface Reference

Job that has a run() method and metadata accessors for JobQueue::pop() and JobQueue::ack() More...

Inheritance diagram for RunnableJob:
Collaboration diagram for RunnableJob:

Public Member Functions

 allowRetries ()
 
 getLastError ()
 
 getMetadata ( $field=null)
 
 getReadyTimestamp ()
 
 getRequestId ()
 
 hasExecutionFlag ( $flag)
 
 run ()
 Run the job.
 
 setMetadata ( $field, $value)
 
 tearDown ( $status)
 Do any final cleanup after run(), deferred updates, and all DB commits happen.
 
 toString ()
 
 workItemCount ()
 
- Public Member Functions inherited from IJobSpecification
 getDeduplicationInfo ()
 Subclasses may need to override this to make duplication detection work.
 
 getParams ()
 
 getReleaseTimestamp ()
 
 getRootJobParams ()
 
 getType ()
 
 hasRootJobParams ()
 
 ignoreDuplicates ()
 
 isRootJob ()
 

Detailed Description

Job that has a run() method and metadata accessors for JobQueue::pop() and JobQueue::ack()

Instances are not only enqueueable via JobQueue::push(), but they can also be executed by by calling their run() method. When constructing a job to be enqueued via JobQueue::push(), it will not be possible to construct a RunnableJob instance if the class for that job is not loaded by the application for the local DB domain. In that case, the general-purpose JobSpecification class can be used instead.

Stability: stable
to implement
Since
1.33

Definition at line 37 of file RunnableJob.php.

Member Function Documentation

◆ allowRetries()

RunnableJob::allowRetries ( )
Returns
bool Whether this job can be retried on failure by job runners
Since
1.21

Implemented in Job, AssembleUploadChunksJob, PublishStashedFileJob, and ThumbnailRenderJob.

◆ getLastError()

RunnableJob::getLastError ( )
Returns
string

Implemented in Job.

◆ getMetadata()

RunnableJob::getMetadata ( $field = null)
Parameters
string | null$fieldMetadata field or null to get all the metadata
Returns
mixed|null Value; null if missing

Implemented in Job.

◆ getReadyTimestamp()

RunnableJob::getReadyTimestamp ( )
Returns
int|null UNIX timestamp of when the job was runnable, or null
Since
1.26

Implemented in Job.

◆ getRequestId()

RunnableJob::getRequestId ( )
Returns
string|null Id of the request that created this job. Follows jobs recursively, allowing to track the id of the request that started a job when jobs insert jobs which insert other jobs.
Since
1.27

Implemented in Job.

◆ hasExecutionFlag()

RunnableJob::hasExecutionFlag ( $flag)
Parameters
int$flagJOB_* class constant
Returns
bool
Since
1.31

Implemented in Job.

◆ run()

◆ setMetadata()

RunnableJob::setMetadata ( $field,
$value )
Parameters
string$fieldKey name to set the value for
mixed$valueThe value to set the field for
Returns
mixed|null The prior field value; null if missing

Implemented in Job.

◆ tearDown()

RunnableJob::tearDown ( $status)

Do any final cleanup after run(), deferred updates, and all DB commits happen.

Parameters
bool$statusWhether the job, its deferred updates, and DB commit all succeeded
Since
1.27

◆ toString()

RunnableJob::toString ( )
Returns
string Debugging string describing the job

Implemented in Job.

◆ workItemCount()

RunnableJob::workItemCount ( )
Returns
int Number of actually "work items" handled in this job
See also
$wgJobBackoffThrottling
Since
1.23

Implemented in Job, HTMLCacheUpdateJob, and RefreshLinksJob.


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