http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76352
Revision: 76352
Author: diederik
Date: 2010-11-08 23:29:23 +0000 (Mon, 08 Nov 2010)
Log Message:
-----------
Finetuning process class
Modified Paths:
--------------
trunk/tools/editor_trends/map_wiki_editors.py
trunk/tools/editor_trends/utils/models.py
Modified: trunk/tools/editor_trends/map_wiki_editors.py
===================================================================
--- trunk/tools/editor_trends/map_wiki_editors.py 2010-11-08 23:29:23 UTC
(rev 76351)
+++ trunk/tools/editor_trends/map_wiki_editors.py 2010-11-08 23:29:23 UTC
(rev 76352)
@@ -127,7 +127,7 @@
vars = {}
-def parse_editors(xml_queue, output, pbar, bots, **kwargs):
+def parse_editors(xml_queue, data_queue, **kwargs):
'''
@xml_queue contains the filenames of the files to be parsed
@data_queue is an instance of Queue where the extracted data is stored for
@@ -142,7 +142,8 @@
output = kwargs.get('output', None)
debug = kwargs.get('debug', False)
destination = kwargs.get('destination', 'file')
-
+ bots = kwargs.get('bots', None)
+ pbar = kwargs.get('pbar', None)
if settings.DEBUG:
messages = {}
vars = {}
@@ -220,7 +221,7 @@
utils.report_error_messages(messages, parse_editors)
-def store_editors(data_queue, pids, dbname):
+def store_editors(data_queue, **kwargs):
'''
@data_queue is an instance of Queue containing information extracted by
parse_editors()
@@ -228,10 +229,12 @@
running
@dbname is the name of the MongoDB collection where to store the
information.
'''
+ dbname = kwargs.get('dbname', None)
mongo = db.init_mongo_db(dbname)
collection = mongo['editors']
mongo.collection.ensure_index('editor')
editor_cache = cache.EditorCache(collection)
+
while True:
try:
edit = data_queue.get(block=False)
Modified: trunk/tools/editor_trends/utils/models.py
===================================================================
--- trunk/tools/editor_trends/utils/models.py 2010-11-08 23:29:23 UTC (rev
76351)
+++ trunk/tools/editor_trends/utils/models.py 2010-11-08 23:29:23 UTC (rev
76352)
@@ -35,7 +35,7 @@
if kw not in IGNORE and not kw.startswith('_'):
kwargs[kw] = getattr(self, kw)
- self.target(self.input_queue, self.result_queue, self.pbar, kwargs)
+ self.target(self.input_queue, self.result_queue, **kwargs)
class ProcessResultQueue(multiprocessing.Process):
@@ -56,4 +56,4 @@
if kw not in IGNORE and not kw.startswith('_'):
kwargs[kw] = getattr(self, kw)
- self.target(self.result_queue, self.pids, self.dbname)
+ self.target(self.result_queue, **kwargs)
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs