Expose job metadata in showJobs and the jobs log
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 21 Oct 2014 22:07:39 +0000 (15:07 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 22 Oct 2014 18:40:18 +0000 (18:40 +0000)
* This means that redis job UUIDs now show up in these places

Change-Id: Icea168de7e1590bfe275646bc2ccbb7151f032ae

includes/jobqueue/Job.php

index d01a279..56fd1c6 100644 (file)
@@ -277,13 +277,22 @@ abstract class Job implements IJobSpecification {
                        }
                }
 
-               if ( is_object( $this->title ) ) {
-                       $s = "{$this->command} {$this->title->getPrefixedDBkey()}";
-                       if ( $paramString !== '' ) {
-                               $s .= " $paramString";
+               $metaString = '';
+               foreach ( $this->metadata as $key => $value ) {
+                       if ( is_scalar( $value ) && mb_strlen( $value ) < 1024 ) {
+                               $metaString .= ( $metaString ? ",$key=$value" : "$key=$value" );
                        }
-               } else {
-                       $s = "{$this->command} $paramString";
+               }
+
+               $s = $this->command;
+               if ( is_object( $this->title ) ) {
+                       $s .= " {$this->title->getPrefixedDBkey()}";
+               }
+               if ( $paramString != '' ) {
+                       $s .= " $paramString";
+               }
+               if ( $metaString != '' ) {
+                       $s .= " ($metaString)";
                }
 
                return $s;