jenkins-bot has submitted this change and it was merged.
Change subject: Added support for result=json parameter to runJobs.php
......................................................................
Added support for result=json parameter to runJobs.php
* This can let the caller get info about what was run, just like the web version
Change-Id: I49d7eccee52eb1dc161249fdc0546259ccf1f959
---
M maintenance/runJobs.php
1 file changed, 10 insertions(+), 2 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php
index 3e6fa52..c757802 100644
--- a/maintenance/runJobs.php
+++ b/maintenance/runJobs.php
@@ -37,6 +37,7 @@
$this->addOption( 'type', 'Type of job to run', false, true );
$this->addOption( 'procs', 'Number of processes to use', false,
true );
$this->addOption( 'nothrottle', 'Ignore job throttling
configuration', false, false );
+ $this->addOption( 'result', 'Set to JSON to print only a JSON
response', false, false );
}
public function memoryLimit() {
@@ -65,14 +66,21 @@
}
}
+ $json = ( $this->getOption( 'result' ) === 'json' );
+
$runner = new JobRunner();
- $runner->setDebugHandler( array( $this, 'debugInternal' ) );
- $runner->run( array(
+ if ( !$json ) {
+ $runner->setDebugHandler( array( $this, 'debugInternal'
) );
+ }
+ $response = $runner->run( array(
'type' => $this->getOption( 'type', false ),
'maxJobs' => $this->getOption( 'maxjobs', false ),
'maxTime' => $this->getOption( 'maxtime', false ),
'throttle' => $this->hasOption( 'nothrottle' ) ? false
: true,
) );
+ if ( $json ) {
+ $this->output( FormatJson::encode( $response, true ) );
+ }
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/149908
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I49d7eccee52eb1dc161249fdc0546259ccf1f959
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits