http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83641

Revision: 83641
Author:   tstarling
Date:     2011-03-10 05:29:09 +0000 (Thu, 10 Mar 2011)
Log Message:
-----------
* MFT r83640: --maxtime parameter
* In jobs-loop.sh, limit job time to 5 minutes

Modified Paths:
--------------
    branches/wmf/1.17wmf1/maintenance/jobs-loop.sh
    branches/wmf/1.17wmf1/maintenance/runJobs.php

Property Changed:
----------------
    branches/wmf/1.17wmf1/maintenance/runJobs.php

Modified: branches/wmf/1.17wmf1/maintenance/jobs-loop.sh
===================================================================
--- branches/wmf/1.17wmf1/maintenance/jobs-loop.sh      2011-03-10 05:26:34 UTC 
(rev 83640)
+++ branches/wmf/1.17wmf1/maintenance/jobs-loop.sh      2011-03-10 05:29:09 UTC 
(rev 83641)
@@ -18,7 +18,7 @@
                        db=`php -n nextJobDB.php --type="$type"`
                        if [ -n "$db" ]; then
                                echo "$db $type"
-                               nice -n 20 php runJobs.php --wiki="$db" 
--procs=4 --type="$type" &
+                               nice -n 20 php runJobs.php --wiki="$db" 
--procs=4 --type="$type" --maxtime=300 &
                                wait
                                moreprio=y
                        fi
@@ -34,7 +34,7 @@
                sleep 5
        else
                echo "$db"
-               nice -n 20 php runJobs.php --wiki="$db" --procs=4 &
+               nice -n 20 php runJobs.php --wiki="$db" --procs=4 --maxtime=300 
&
                wait
        fi
 done

Modified: branches/wmf/1.17wmf1/maintenance/runJobs.php
===================================================================
--- branches/wmf/1.17wmf1/maintenance/runJobs.php       2011-03-10 05:26:34 UTC 
(rev 83640)
+++ branches/wmf/1.17wmf1/maintenance/runJobs.php       2011-03-10 05:29:09 UTC 
(rev 83641)
@@ -31,6 +31,7 @@
                parent::__construct();
                $this->mDescription = "Run pending jobs";
                $this->addOption( 'maxjobs', 'Maximum number of jobs to run', 
false, true );
+               $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 );
        }
@@ -52,7 +53,9 @@
                                exit( 0 );
                        }
                }
-               $maxJobs = $this->getOption( 'maxjobs', 10000 );
+               $maxJobs = $this->getOption( 'maxjobs', false );
+               $maxTime = $this->getOption( 'maxtime', false );
+               $startTime = time();
                $type = $this->getOption( 'type', false );
                $wgTitle = Title::newFromText( 'RunJobs.php' );
                $dbw = wfGetDB( DB_MASTER );
@@ -80,9 +83,13 @@
                                } else {
                                        $this->runJobsLog( $job->toString() . " 
t=$timeMs good" );
                                }
+
                                if ( $maxJobs && ++$n > $maxJobs ) {
                                        break 2;
                                }
+                               if ( $maxTime && time() - $startTime > $maxTime 
) {
+                                       break 2;
+                               }
                        }
                }
        }


Property changes on: branches/wmf/1.17wmf1/maintenance/runJobs.php
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/REL1_15/phase3/maintenance/runJobs.php:51646
/branches/new-installer/phase3/maintenance/runJobs.php:43664-66004
/branches/sqlite/maintenance/runJobs.php:58211-58321
/branches/wmf/1.16wmf4/maintenance/runJobs.php:67177,69199,76243,77266
/branches/wmf-deployment/maintenance/runJobs.php:60970
/trunk/phase3/maintenance/runJobs.php:79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,81833,83212,83590,83640


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to