r76352 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76351‎ | r76352 | r76353 >
Date:23:29, 8 November 2010
Author:diederik
Status:deferred
Tags:
Comment:
Finetuning process class
Modified paths:
  • /trunk/tools/editor_trends/map_wiki_editors.py (modified) (history)
  • /trunk/tools/editor_trends/utils/models.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/map_wiki_editors.py
@@ -127,7 +127,7 @@
128128 vars = {}
129129
130130
131 -def parse_editors(xml_queue, output, pbar, bots, **kwargs):
 131+def parse_editors(xml_queue, data_queue, **kwargs):
132132 '''
133133 @xml_queue contains the filenames of the files to be parsed
134134 @data_queue is an instance of Queue where the extracted data is stored for
@@ -142,7 +142,8 @@
143143 output = kwargs.get('output', None)
144144 debug = kwargs.get('debug', False)
145145 destination = kwargs.get('destination', 'file')
146 -
 146+ bots = kwargs.get('bots', None)
 147+ pbar = kwargs.get('pbar', None)
147148 if settings.DEBUG:
148149 messages = {}
149150 vars = {}
@@ -220,7 +221,7 @@
221222 utils.report_error_messages(messages, parse_editors)
222223
223224
224 -def store_editors(data_queue, pids, dbname):
 225+def store_editors(data_queue, **kwargs):
225226 '''
226227 @data_queue is an instance of Queue containing information extracted by
227228 parse_editors()
@@ -228,10 +229,12 @@
229230 running
230231 @dbname is the name of the MongoDB collection where to store the information.
231232 '''
 233+ dbname = kwargs.get('dbname', None)
232234 mongo = db.init_mongo_db(dbname)
233235 collection = mongo['editors']
234236 mongo.collection.ensure_index('editor')
235237 editor_cache = cache.EditorCache(collection)
 238+
236239 while True:
237240 try:
238241 edit = data_queue.get(block=False)
Index: trunk/tools/editor_trends/utils/models.py
@@ -35,7 +35,7 @@
3636 if kw not in IGNORE and not kw.startswith('_'):
3737 kwargs[kw] = getattr(self, kw)
3838
39 - self.target(self.input_queue, self.result_queue, self.pbar, kwargs)
 39+ self.target(self.input_queue, self.result_queue, **kwargs)
4040
4141
4242 class ProcessResultQueue(multiprocessing.Process):
@@ -56,4 +56,4 @@
5757 if kw not in IGNORE and not kw.startswith('_'):
5858 kwargs[kw] = getattr(self, kw)
5959
60 - self.target(self.result_queue, self.pids, self.dbname)
 60+ self.target(self.result_queue, **kwargs)

Status & tagging log