r85645 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85644‎ | r85645 | r85646 >
Date:21:46, 7 April 2011
Author:diederik
Status:deferred
Tags:
Comment:
Fixed issue where sometimes output was not written to file.
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -35,6 +35,9 @@
3636 from analyses.adhoc import bot_detector
3737 from utils import file_utils
3838
 39+filehandles = [file_utils.create_txt_filehandle(path, '%s.csv' % fh, 'a',
 40+ 'utf-8') for fh in xrange(rts.max_filehandles)]
 41+
3942 EXCLUDE_NAMESPACE = {
4043 #0:'Main',
4144 #1:'Talk',
@@ -87,19 +90,7 @@
8891 print 'Worker %s: Number of articles: %s' % (self.process_id, self.count_articles)
8992 print 'Worker %s: Number of revisions: %s' % (self.process_id, self.count_revisions)
9093
91 -class Dummy:
92 - pass
9394
94 -class DummyRTS:
95 - def __init__(self, location, path):
96 - self.input_location = location
97 - self.output_location = path
98 - self.language = Dummy()
99 - self.project = Dummy()
100 - self.language.code = 'en'
101 - self.project.name = 'wiki'
102 -
103 -
10495 class Buffer:
10596 def __init__(self, storage, process_id, rts=None, filehandles=None, locks=None):
10697 assert storage == 'cassandra' or storage == 'mongo' or storage == 'csv', \
@@ -677,8 +668,8 @@
678669 bots = bot_detector.retrieve_bots(rts.language.code)
679670 path = os.path.join(rts.output_location, 'txt')
680671
681 - filehandles = [file_utils.create_txt_filehandle(path, '%s.csv' % fh, 'a',
682 - 'utf-8') for fh in xrange(rts.max_filehandles)]
 672+ #filehandles = [file_utils.create_txt_filehandle(path, '%s.csv' % fh, 'a',
 673+ # 'utf-8') for fh in xrange(rts.max_filehandles)]
683674
684675 title_file = os.path.join(path, 'titles.csv')
685676 comment_file = os.path.join(path, 'comments.csv')