r81362 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81361‎ | r81362 | r81363 >
Date:00:24, 2 February 2011
Author:diederik
Status:deferred
Tags:
Comment:
More descriptive error message if data cannot be stored in Mongo.
Modified paths:
  • /trunk/tools/editor_trends/database/cache.py (modified) (history)
  • /trunk/tools/editor_trends/etl/store.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/database/cache.py
@@ -82,7 +82,7 @@
8383 try:
8484 self.collection.insert({'editor': editor, 'edits': values, 'username': username}, safe=True)
8585 except bson.errors.InvalidDocument:
86 - print 'BSON document too large'
 86+ print 'BSON document too large, unable to store %s' % (username)
8787
8888 def store(self):
8989 file_utils.store_object(self, settings.binary_location, self.__repr__())
Index: trunk/tools/editor_trends/etl/store.py
@@ -44,7 +44,6 @@
4545
4646 editor_cache = cache.EditorCache(collection)
4747 prev_contributor = -1
48 - #edits = 0
4948 while True:
5049 try:
5150 filename = tasks.get(block=False)
@@ -58,19 +57,12 @@
5958 print '%s files left in the queue.' % messages.show(tasks.qsize)
6059
6160 fh = file_utils.create_txt_filehandle(source, filename, 'r', settings.encoding)
62 - print fh
6361 for line in file_utils.read_raw_data(fh):
6462 if len(line) > 1:
6563 contributor = line[0]
6664 #print 'Parsing %s' % contributor
67 - if prev_contributor != contributor:
68 - #if edits > 9:
 65+ if prev_contributor != contributor and prev_contributor != -1:
6966 editor_cache.add(prev_contributor, 'NEXT')
70 - print 'Stored %s' % prev_contributor
71 - #else:
72 - # editor_cache.clear(prev_contributor)
73 - #edits = 0
74 - edits += 1
7567 date = text_utils.convert_timestamp_to_datetime_utc(line[1])
7668 article_id = int(line[2])
7769 username = line[3].encode(settings.encoding)

Status & tagging log