MediaWiki  REL1_21
JobQueueGroup Class Reference

Class to handle enqueueing of background jobs. More...

Collaboration diagram for JobQueueGroup:

List of all members.

Public Member Functions

 ack (Job $job)
 Acknowledge that a job was completed.
 deduplicateRootJob (Job $job)
 Register the "root job" of a given job into the queue for de-duplication.
 executeReadyPeriodicTasks ()
 Execute any due periodic queue maintenance tasks for all queues.
 get ($type)
 Get the job queue object for a given queue type.
 getDefaultQueueTypes ()
 Get the list of default queue types.
 getQueuesWithJobs ()
 Get the list of job types that have non-empty queues.
 getQueueTypes ()
 Get the list of queue types.
 isQueueDeprioritized ($type)
 Check if jobs should not be popped of a queue right now.
 pop ($qtype=self::TYPE_DEFAULT, $flags=0)
 Pop a job off one of the job queues.
 push ($jobs)
 Insert jobs into the respective queues of with the belong.
 waitForBackups ()
 Wait for any slaves or backup queue servers to catch up.

Static Public Member Functions

static destroySingletons ()
 Destroy the singleton instances.
static singleton ($wiki=false)

Public Attributes

const CACHE_VERSION = 1
const PROC_CACHE_TTL = 15
const TYPE_ANY = 2
const TYPE_DEFAULT = 1
const USE_CACHE = 1

Protected Member Functions

 __construct ($wiki)

Protected Attributes

ProcessCacheLRU $cache
 *
 $wiki

Static Protected Attributes

static $instances = array()

Private Member Functions

 getCachedConfigVar ($name)

Detailed Description

Class to handle enqueueing of background jobs.

Since:
1.21

Definition at line 30 of file JobQueueGroup.php.


Constructor & Destructor Documentation

JobQueueGroup::__construct ( wiki) [protected]
Parameters:
string$wikiWiki ID

Definition at line 50 of file JobQueueGroup.php.


Member Function Documentation

JobQueueGroup::ack ( Job job)

Acknowledge that a job was completed.

Parameters:
$jobJob
Returns:
bool

Definition at line 188 of file JobQueueGroup.php.

Register the "root job" of a given job into the queue for de-duplication.

This should only be called right *after* all the new jobs have been inserted.

Parameters:
$jobJob
Returns:
bool

Definition at line 199 of file JobQueueGroup.php.

static JobQueueGroup::destroySingletons ( ) [static]

Destroy the singleton instances.

Returns:
void

Definition at line 72 of file JobQueueGroup.php.

Referenced by TemplateCategoriesTest\testTemplateCategories().

Execute any due periodic queue maintenance tasks for all queues.

A task is "due" if the time ellapsed since the last run is greater than the defined run period. Concurrent calls to this function will cause tasks to be attempted twice, so they may need their own methods of mutual exclusion.

Returns:
integer Number of tasks run

Definition at line 283 of file JobQueueGroup.php.

JobQueueGroup::get ( type)

Get the job queue object for a given queue type.

Parameters:
$typestring
Returns:
JobQueue

Definition at line 82 of file JobQueueGroup.php.

JobQueueGroup::getCachedConfigVar ( name) [private]
Parameters:
$namestring
Returns:
mixed

Definition at line 332 of file JobQueueGroup.php.

Get the list of default queue types.

Returns:
array List of strings

Definition at line 236 of file JobQueueGroup.php.

Get the list of job types that have non-empty queues.

Returns:
Array List of job types that have non-empty queues

Definition at line 247 of file JobQueueGroup.php.

Get the list of queue types.

Returns:
array List of strings

Definition at line 227 of file JobQueueGroup.php.

Check if jobs should not be popped of a queue right now.

This is only used for performance, such as to avoid spamming the queue with many sub-jobs before they actually get run.

Parameters:
$typestring
Returns:
bool

Definition at line 265 of file JobQueueGroup.php.

JobQueueGroup::pop ( qtype = self::TYPE_DEFAULT,
flags = 0 
)

Pop a job off one of the job queues.

This pops a job off a queue as specified by $wgJobTypeConf and updates the aggregate job queue information cache as needed.

Parameters:
$qtypeinteger|string JobQueueGroup::TYPE_DEFAULT or type string
$flagsinteger Bitfield of JobQueueGroup::USE_* constants
Returns:
Job|bool Returns false on failure

Definition at line 146 of file JobQueueGroup.php.

JobQueueGroup::push ( jobs)

Insert jobs into the respective queues of with the belong.

This inserts the jobs into the queue specified by $wgJobTypeConf and updates the aggregate job queue information cache as needed.

Parameters:
$jobsJob|array A single Job or a list of Jobs
Exceptions:
MWException
Returns:
bool

Definition at line 105 of file JobQueueGroup.php.

Wait for any slaves or backup queue servers to catch up.

This does nothing for certain queue classes.

Returns:
void
Exceptions:
MWException

Definition at line 211 of file JobQueueGroup.php.


Member Data Documentation

ProcessCacheLRU JobQueueGroup::$cache [protected]

*

Definition at line 34 of file JobQueueGroup.php.

JobQueueGroup::$instances = array() [static, protected]

Definition at line 32 of file JobQueueGroup.php.

JobQueueGroup::$wiki [protected]

Definition at line 36 of file JobQueueGroup.php.

Definition at line 45 of file JobQueueGroup.php.

Definition at line 43 of file JobQueueGroup.php.

Definition at line 39 of file JobQueueGroup.php.

Definition at line 38 of file JobQueueGroup.php.

Referenced by RunJobs\execute().

Definition at line 41 of file JobQueueGroup.php.

Referenced by RunJobs\execute().


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