Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/199973
Change subject: Made showJobs.php include abandoned jobs in --list
......................................................................
Made showJobs.php include abandoned jobs in --list
Change-Id: I7ae8dd2470d5e15fd66c6c06f3feb6d70527daa3
---
M includes/jobqueue/JobQueue.php
M includes/jobqueue/JobQueueFederated.php
M includes/jobqueue/JobQueueRedis.php
M maintenance/showJobs.php
4 files changed, 48 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/73/199973/1
diff --git a/includes/jobqueue/JobQueue.php b/includes/jobqueue/JobQueue.php
index f4fe913..91fe86c 100644
--- a/includes/jobqueue/JobQueue.php
+++ b/includes/jobqueue/JobQueue.php
@@ -616,6 +616,17 @@
}
/**
+ * Get an iterator to traverse over all abandoned jobs in this queue
+ *
+ * @return Iterator
+ * @throws JobQueueError
+ * @since 1.25
+ */
+ public function getAllAbandonedJobs() {
+ return new ArrayIterator( array() ); // not implemented
+ }
+
+ /**
* Do not use this function outside of JobQueue/JobQueueGroup
*
* @return string
diff --git a/includes/jobqueue/JobQueueFederated.php
b/includes/jobqueue/JobQueueFederated.php
index 1d84dc4..d985d44 100644
--- a/includes/jobqueue/JobQueueFederated.php
+++ b/includes/jobqueue/JobQueueFederated.php
@@ -422,6 +422,17 @@
return $iterator;
}
+ public function getAllAbandonedJobs() {
+ $iterator = new AppendIterator();
+
+ /** @var JobQueue $queue */
+ foreach ( $this->partitionQueues as $queue ) {
+ $iterator->append( $queue->getAllAbandonedJobs() );
+ }
+
+ return $iterator;
+ }
+
public function getCoalesceLocationInternal() {
return "JobQueueFederated:wiki:{$this->wiki}" .
sha1( serialize( array_keys( $this->partitionQueues ) )
);
diff --git a/includes/jobqueue/JobQueueRedis.php
b/includes/jobqueue/JobQueueRedis.php
index d9fe30b..6c823fb 100644
--- a/includes/jobqueue/JobQueueRedis.php
+++ b/includes/jobqueue/JobQueueRedis.php
@@ -516,6 +516,29 @@
}
}
+ /**
+ * @see JobQueue::getAllAbandonedJobs()
+ * @return Iterator
+ */
+ public function getAllAbandonedJobs() {
+ $conn = $this->getConnection();
+ try {
+ $that = $this;
+
+ return new MappedIterator( // delayed jobs
+ $conn->zRange( $this->getQueueKey(
'z-abandoned' ), 0, -1 ),
+ function ( $uid ) use ( $that, $conn ) {
+ return $that->getJobFromUidInternal(
$uid, $conn );
+ },
+ array( 'accept' => function ( $job ) {
+ return is_object( $job );
+ } )
+ );
+ } catch ( RedisException $e ) {
+ $this->throwRedisException( $conn, $e );
+ }
+ }
+
public function getCoalesceLocationInternal() {
return "RedisServer:" . $this->server;
}
diff --git a/maintenance/showJobs.php b/maintenance/showJobs.php
index a9f7d8b..9e9ad32 100644
--- a/maintenance/showJobs.php
+++ b/maintenance/showJobs.php
@@ -58,6 +58,9 @@
foreach ( $queue->getAllDelayedJobs() as $job )
{
$this->output( $job->toString() . "
status=delayed\n" );
}
+ foreach ( $queue->getAllAbandonedJobs() as $job
) {
+ $this->output( $job->toString() . "
status=abandoned\n" );
+ }
}
} elseif ( $this->hasOption( 'group' ) ) {
foreach ( $group->getQueueTypes() as $type ) {
--
To view, visit https://gerrit.wikimedia.org/r/199973
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ae8dd2470d5e15fd66c6c06f3feb6d70527daa3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits