r84766 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84765‎ | r84766 | r84767 >
Date:21:09, 25 March 2011
Author:diederik
Status:deferred
Tags:
Comment:
Added garbage collector for debugging purposes.
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -26,6 +26,7 @@
2727 import re
2828 import sys
2929 import datetime
 30+import gc
3031 import progressbar
3132 from multiprocessing import JoinableQueue, Process, cpu_count, current_process
3233 from xml.etree.cElementTree import fromstring, iterparse
@@ -430,8 +431,15 @@
431432 counts = function(article, counts, bots)
432433 buffer = cStringIO.StringIO()
433434
434 - if i % 10000 == 0:
 435+ if i % 1000 == 0:
435436 print 'Worker %s parsed %s articles' % (id, i)
 437+ print gc.get_count()
 438+ gc.collect()
 439+ print '************************'
 440+ gc.DEBUG_COLLECTABLE
 441+ gc.DEBUG_UNCOLLECTABLE
 442+ gc.DEBUG_STATS
 443+ print '************************'
436444
437445 if dataset == 'training':
438446 cache.empty()
@@ -508,4 +516,5 @@
509517
510518 if __name__ == '__main__':
511519 #launcher_training()
 520+ gc.enable()
512521 launcher_prediction()

Status & tagging log