r83641 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83640‎ | r83641 | r83642 >
Date:05:29, 10 March 2011
Author:tstarling
Status:ok
Tags:
Comment:
* MFT r83640: --maxtime parameter
* In jobs-loop.sh, limit job time to 5 minutes
Modified paths:
  • /branches/wmf/1.17wmf1/maintenance/jobs-loop.sh (modified) (history)
  • /branches/wmf/1.17wmf1/maintenance/runJobs.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/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 }
Property changes on: branches/wmf/1.17wmf1/maintenance/runJobs.php
___________________________________________________________________
Added: svn:mergeinfo
9097 Merged /branches/sqlite/maintenance/runJobs.php:r58211-58321
9198 Merged /trunk/phase3/maintenance/runJobs.php:r79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81833,83212,83590,83640
9299 Merged /branches/new-installer/phase3/maintenance/runJobs.php:r43664-66004
93100 Merged /branches/wmf-deployment/maintenance/runJobs.php:r60970
94101 Merged /branches/REL1_15/phase3/maintenance/runJobs.php:r51646
95102 Merged /branches/wmf/1.16wmf4/maintenance/runJobs.php:r67177,69199,76243,77266
Index: branches/wmf/1.17wmf1/maintenance/jobs-loop.sh
@@ -18,7 +18,7 @@
1919 db=`php -n nextJobDB.php --type="$type"`
2020 if [ -n "$db" ]; then
2121 echo "$db $type"
22 - nice -n 20 php runJobs.php --wiki="$db" --procs=4 --type="$type" &
 22+ nice -n 20 php runJobs.php --wiki="$db" --procs=4 --type="$type" --maxtime=300 &
2323 wait
2424 moreprio=y
2525 fi
@@ -34,7 +34,7 @@
3535 sleep 5
3636 else
3737 echo "$db"
38 - nice -n 20 php runJobs.php --wiki="$db" --procs=4 &
 38+ nice -n 20 php runJobs.php --wiki="$db" --procs=4 --maxtime=300 &
3939 wait
4040 fi
4141 done

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83640Add --maxtime parameter to allow job runners to be limited by time instead of...tstarling05:26, 10 March 2011

Status & tagging log