jenkins-bot has submitted this change and it was merged.

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 includes/job/JobQueue.php
M maintenance/showJobs.php
2 files changed, 14 insertions(+), 3 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/job/JobQueue.php b/includes/job/JobQueue.php
index 3295c24..aa47432 100644
--- a/includes/job/JobQueue.php
+++ b/includes/job/JobQueue.php
@@ -597,7 +597,7 @@
        /**
         * Get an iterator to traverse over all available jobs in this queue.
         * This does not include jobs that are currently acquired or delayed.
-        * This should only be called on a queue that is no longer being popped.
+        * Note: results may be stale if the queue is concurrently modified.
         *
         * @return Iterator
         * @throws MWException
@@ -606,7 +606,7 @@
 
        /**
         * Get an iterator to traverse over all delayed jobs in this queue.
-        * This should only be called on a queue that is no longer being popped.
+        * Note: results may be stale if the queue is concurrently modified.
         *
         * @return Iterator
         * @throws MWException
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: merged
Gerrit-Change-Id: Idfa3f52ba89638892fc7a64d6566955d66de5958
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to