[MediaWiki-commits] [Gerrit] Allow setting maxChunks (examined) in ChangeDispatcher - change (mediawiki...Wikibase)

2015-08-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Allow setting maxChunks (examined) in ChangeDispatcher
..


Allow setting maxChunks (examined) in ChangeDispatcher

maxChunks is the number of chunks of changes examined
when selecting pending changes for a wiki.

for small wikis, after filtering for relevance to that
wiki, it might be 0 changes from a chunk that is added
to the batch. then the dispatcher gets stuck in a loop,
not reaching the maxBatchSize.

This adds an option to the dispatcher script to adjust
this number and to set it in the ChangeDispatcher, for
improved testability.

(tests coming in follow up)

Change-Id: I0de975ac7e65d41ff8bdbc3682be9b40bb1c9ef8
---
M repo/includes/ChangeDispatcher.php
M repo/maintenance/dispatchChanges.php
2 files changed, 24 insertions(+), 1 deletion(-)

Approvals:
  Jonas Kress (WMDE): Looks good to me, but someone else must approve
  Thiemo Mättig (WMDE): Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/ChangeDispatcher.php 
b/repo/includes/ChangeDispatcher.php
index 83d5393..29bb0d6 100644
--- a/repo/includes/ChangeDispatcher.php
+++ b/repo/includes/ChangeDispatcher.php
@@ -37,6 +37,11 @@
private $batchChunkFactor = 3;
 
/**
+* @var int: max chunks / passes per wiki when selecting pending 
changes.
+*/
+   private $maxChunks = 15;
+
+   /**
 * @var bool: whether output should be verbose.
 */
private $verbose = false;
@@ -155,6 +160,20 @@
 */
public function getBatchChunkFactor() {
return $this-batchChunkFactor;
+   }
+
+   /**
+* @param int $maxChunks Max number of chunks / passes per wiki when 
selecting pending changes.
+*/
+   public function setMaxChunks( $maxChunks ) {
+   $this-maxChunks = $maxChunks;
+   }
+
+   /**
+* @return int
+*/
+   public function getMaxChunks() {
+   return $this-maxChunks;
}
 
/**
@@ -282,7 +301,7 @@
// Note that this is non-trivial due to programmatic filtering.
$lastIdSeen = $after;
 
-   while ( $batchSize  $this-batchSize  $chunksExamined  15 ) 
{
+   while ( $batchSize  $this-batchSize  $chunksExamined  
$this-maxChunks ) {
// get a chunk of changes
$chunk = $this-chunkedChangesAccess-loadChunk( 
$after+1, $chunkSize );
 
diff --git a/repo/maintenance/dispatchChanges.php 
b/repo/maintenance/dispatchChanges.php
index a98a48e..65484ba 100644
--- a/repo/maintenance/dispatchChanges.php
+++ b/repo/maintenance/dispatchChanges.php
@@ -56,6 +56,8 @@
. Default: 1 if --max-time is not set, 
infinite if it is., false, true );
$this-addOption( 'max-time', The number of seconds to run 
before exiting, 
. if --max-passes is not reached. 
Default: infinite., false, true );
+   $this-addOption( 'max-chunks', Max number of chunks / passes 
per wiki 
+   . when selecting pending changes. 
Default: 15, false, true );
$this-addOption( 'batch-size', Max number of changes to pass 
to a client at a time. 
. Default: 1000, false, true );
}
@@ -78,6 +80,7 @@
$subscriptionLookupMode = $settings-getSetting( 
'subscriptionLookupMode' );
 
$batchSize = (int)$this-getOption( 'batch-size', 1000 );
+   $maxChunks = (int)$this-getOption( 'max-chunks', 15 );
$dispatchInterval = (int)$this-getOption( 'dispatch-interval', 
60 );
$lockGraceInterval = (int)$this-getOption( 
'lock-grace-interval', 60 );
$randomness = (int)$this-getOption( 'randomness', 10 );
@@ -129,6 +132,7 @@
$dispatcher-setMessageReporter( $reporter );
$dispatcher-setExceptionHandler( new 
ReportingExceptionHandler( $reporter ) );
$dispatcher-setBatchSize( $batchSize );
+   $dispatcher-setMaxChunks( $maxChunks );
$dispatcher-setBatchChunkFactor( $batchChunkFactor );
$dispatcher-setVerbose( $this-verbose );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0de975ac7e65d41ff8bdbc3682be9b40bb1c9ef8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude aude.w...@gmail.com
Gerrit-Reviewer: Aude aude.w...@gmail.com
Gerrit-Reviewer: Jonas Kress (WMDE) jonas.kr...@wikimedia.de
Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits 

[MediaWiki-commits] [Gerrit] Allow setting maxChunks (examined) in ChangeDispatcher - change (mediawiki...Wikibase)

2015-08-24 Thread Aude (Code Review)
Aude has uploaded a new change for review.

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

Change subject: Allow setting maxChunks (examined) in ChangeDispatcher
..

Allow setting maxChunks (examined) in ChangeDispatcher

maxChunks is the number of chunks of changes examined
when selecting pending changes for a wiki.

for small wikis, after filtering for relevance to that
wiki, it might be 0 changes from a chunk that is added
to the batch. then the dispatcher gets stuck in a loop,
not reaching the maxBatchSize.

This adds an option to the dispatcher script to adjust
this number and to set it in the ChangeDispatcher, for
improved testability.

(tests coming in follow up)

Change-Id: I0de975ac7e65d41ff8bdbc3682be9b40bb1c9ef8
---
M repo/includes/ChangeDispatcher.php
M repo/maintenance/dispatchChanges.php
2 files changed, 24 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/21/233421/1

diff --git a/repo/includes/ChangeDispatcher.php 
b/repo/includes/ChangeDispatcher.php
index 83d5393..29bb0d6 100644
--- a/repo/includes/ChangeDispatcher.php
+++ b/repo/includes/ChangeDispatcher.php
@@ -37,6 +37,11 @@
private $batchChunkFactor = 3;
 
/**
+* @var int: max chunks / passes per wiki when selecting pending 
changes.
+*/
+   private $maxChunks = 15;
+
+   /**
 * @var bool: whether output should be verbose.
 */
private $verbose = false;
@@ -155,6 +160,20 @@
 */
public function getBatchChunkFactor() {
return $this-batchChunkFactor;
+   }
+
+   /**
+* @param int $maxChunks Max number of chunks / passes per wiki when 
selecting pending changes.
+*/
+   public function setMaxChunks( $maxChunks ) {
+   $this-maxChunks = $maxChunks;
+   }
+
+   /**
+* @return int
+*/
+   public function getMaxChunks() {
+   return $this-maxChunks;
}
 
/**
@@ -282,7 +301,7 @@
// Note that this is non-trivial due to programmatic filtering.
$lastIdSeen = $after;
 
-   while ( $batchSize  $this-batchSize  $chunksExamined  15 ) 
{
+   while ( $batchSize  $this-batchSize  $chunksExamined  
$this-maxChunks ) {
// get a chunk of changes
$chunk = $this-chunkedChangesAccess-loadChunk( 
$after+1, $chunkSize );
 
diff --git a/repo/maintenance/dispatchChanges.php 
b/repo/maintenance/dispatchChanges.php
index a98a48e..65484ba 100644
--- a/repo/maintenance/dispatchChanges.php
+++ b/repo/maintenance/dispatchChanges.php
@@ -56,6 +56,8 @@
. Default: 1 if --max-time is not set, 
infinite if it is., false, true );
$this-addOption( 'max-time', The number of seconds to run 
before exiting, 
. if --max-passes is not reached. 
Default: infinite., false, true );
+   $this-addOption( 'max-chunks', Max number of chunks / passes 
per wiki 
+   . when selecting pending changes. 
Default: 15, false, true );
$this-addOption( 'batch-size', Max number of changes to pass 
to a client at a time. 
. Default: 1000, false, true );
}
@@ -78,6 +80,7 @@
$subscriptionLookupMode = $settings-getSetting( 
'subscriptionLookupMode' );
 
$batchSize = (int)$this-getOption( 'batch-size', 1000 );
+   $maxChunks = (int)$this-getOption( 'max-chunks', 15 );
$dispatchInterval = (int)$this-getOption( 'dispatch-interval', 
60 );
$lockGraceInterval = (int)$this-getOption( 
'lock-grace-interval', 60 );
$randomness = (int)$this-getOption( 'randomness', 10 );
@@ -129,6 +132,7 @@
$dispatcher-setMessageReporter( $reporter );
$dispatcher-setExceptionHandler( new 
ReportingExceptionHandler( $reporter ) );
$dispatcher-setBatchSize( $batchSize );
+   $dispatcher-setMaxChunks( $maxChunks );
$dispatcher-setBatchChunkFactor( $batchChunkFactor );
$dispatcher-setVerbose( $this-verbose );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0de975ac7e65d41ff8bdbc3682be9b40bb1c9ef8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude aude.w...@gmail.com

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