r83640 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83639‎ | r83640 | r83641 >
Date:05:26, 10 March 2011
Author:tstarling
Status:ok
Tags:
Comment:
Add --maxtime parameter to allow job runners to be limited by time instead of job count. This makes more sense when --procs is used. Using it on Wikimedia will reduce the effect of laggy slaves.
Modified paths:
  • /trunk/phase3/maintenance/runJobs.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/runJobs.php
@@ -31,6 +31,7 @@
3232 parent::__construct();
3333 $this->mDescription = "Run pending jobs";
3434 $this->addOption( 'maxjobs', 'Maximum number of jobs to run', false, true );
 35+ $this->addOption( 'maxtime', 'Maximum amount of wall-clock time', false, true );
3536 $this->addOption( 'type', 'Type of job to run', false, true );
3637 $this->addOption( 'procs', 'Number of processes to use', false, true );
3738 }
@@ -52,7 +53,9 @@
5354 exit( 0 );
5455 }
5556 }
56 - $maxJobs = $this->getOption( 'maxjobs', 10000 );
 57+ $maxJobs = $this->getOption( 'maxjobs', false );
 58+ $maxTime = $this->getOption( 'maxtime', false );
 59+ $startTime = time();
5760 $type = $this->getOption( 'type', false );
5861 $wgTitle = Title::newFromText( 'RunJobs.php' );
5962 $dbw = wfGetDB( DB_MASTER );
@@ -80,9 +83,13 @@
8184 } else {
8285 $this->runJobsLog( $job->toString() . " t=$timeMs good" );
8386 }
 87+
8488 if ( $maxJobs && ++$n > $maxJobs ) {
8589 break 2;
8690 }
 91+ if ( $maxTime && time() - $startTime > $maxTime ) {
 92+ break 2;
 93+ }
8794 }
8895 }
8996 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r83641* MFT r83640: --maxtime parameter...tstarling05:29, 10 March 2011

Status & tagging log