Tim Starling has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72067


Change subject: Add --list parameter to showJobs.php
......................................................................

Add --list parameter to showJobs.php

For listing all of the jobs in the queue. Post-processing will enable
most sorts of analysis that you would want to do. When we used SQL, this
wasn't reallly necessary, but getting jobs out of Redis is a bit more
tedious.

The format is similar to the log made by runJobs.php.

Change-Id: Idfa3f52ba89638892fc7a64d6566955d66de5958
---
M maintenance/showJobs.php
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/67/72067/1

diff --git a/maintenance/showJobs.php b/maintenance/showJobs.php
index 322a849..e054a36 100644
--- a/maintenance/showJobs.php
+++ b/maintenance/showJobs.php
@@ -38,11 +38,22 @@
                parent::__construct();
                $this->mDescription = "Show number of jobs waiting in master 
database";
                $this->addOption( 'group', 'Show number of jobs per job type' );
+               $this->addOption( 'list', 'Show a complete list of all jobs in 
a machine-readable format, instead of statistics' );
        }
 
        public function execute() {
                $group = JobQueueGroup::singleton();
-               if ( $this->hasOption( 'group' ) ) {
+               if ( $this->hasOption( 'list' ) ) {
+                       foreach ( $group->getQueueTypes() as $type ) {
+                               $queue = $group->get( $type );
+                               foreach ( $queue->getAllQueuedJobs() as $job ) {
+                                       $this->output( $job->toString() . " 
status=unclaimed\n" );
+                               }
+                               foreach ( $queue->getAllDelayedJobs() as $job ) 
{
+                                       $this->output( $job->toString() . " 
status=delayed\n" );
+                               }
+                       }
+               } elseif ( $this->hasOption( 'group' ) ) {
                        foreach ( $group->getQueueTypes() as $type ) {
                                $queue = $group->get( $type );
                                $pending = $queue->getSize();

-- 
To view, visit https://gerrit.wikimedia.org/r/72067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idfa3f52ba89638892fc7a64d6566955d66de5958
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org>

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

Reply via email to