Merge "Made runJobs.php fully respect $wgJobBackoffThrottling"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 8 Apr 2014 16:15:30 +0000 (16:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 8 Apr 2014 16:15:30 +0000 (16:15 +0000)
includes/DefaultSettings.php
maintenance/runJobs.php

index 8f3de1a..a3c22b8 100644 (file)
@@ -6211,6 +6211,7 @@ $wgJobTypesExcludedFromDefaultQueue = array( 'AssembleUploadChunks', 'PublishSta
  * on each job runner process. The meaning of "work items" varies per job,
  * but typically would be something like "pages to update". A single job
  * may have a variable number of work items, as is the case with batch jobs.
+ * This is used by runJobs.php and not jobs run via $wgJobRunRate.
  * These settings should be global to all wikis.
  */
 $wgJobBackoffThrottling = array();
index cd657ac..dc9c763 100644 (file)
@@ -36,6 +36,7 @@ class RunJobs extends Maintenance {
                $this->addOption( 'maxtime', 'Maximum amount of wall-clock time', false, true );
                $this->addOption( 'type', 'Type of job to run', false, true );
                $this->addOption( 'procs', 'Number of processes to use', false, true );
+               $this->addOption( 'nothrottle', 'Ignore job throttling configuration', false, false );
        }
 
        public function memoryLimit() {
@@ -66,6 +67,7 @@ class RunJobs extends Maintenance {
                $type = $this->getOption( 'type', false );
                $maxJobs = $this->getOption( 'maxjobs', false );
                $maxTime = $this->getOption( 'maxtime', false );
+               $noThrottle = $this->hasOption( 'nothrottle' );
                $startTime = time();
 
                $group = JobQueueGroup::singleton();
@@ -83,10 +85,12 @@ class RunJobs extends Maintenance {
                $flags = JobQueueGroup::USE_CACHE;
                $lastTime = time(); // time since last slave check
                do {
+                       $backoffs = array_filter( $backoffs, $backoffExpireFunc );
+                       $blacklist = $noThrottle ? array() : array_keys( $backoffs );
                        if ( $type === false ) {
-                               $backoffs = array_filter( $backoffs, $backoffExpireFunc );
-                               $blacklist = array_keys( $backoffs );
                                $job = $group->pop( JobQueueGroup::TYPE_DEFAULT, $flags, $blacklist );
+                       } elseif ( in_array( $type, $blacklist ) ) {
+                               $job = false; // requested queue in backoff state
                        } else {
                                $job = $group->pop( $type ); // job from a single queue
                        }