http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89902
Revision: 89902 Author: rfaulk Date: 2011-06-12 01:42:26 +0000 (Sun, 12 Jun 2011) Log Message: ----------- Module added for handling multithreading of analytics processing. Wrote MinerThread class which performs the simple function of executing log mining in a separate thread for web reporting. Some refactoring to decouple this module from the DataMapper may be necessary. Added Paths: ----------- trunk/fundraiser-statistics/fundraiser-scripts/classes/FundraiserDataThreading.py Added: trunk/fundraiser-statistics/fundraiser-scripts/classes/FundraiserDataThreading.py =================================================================== --- trunk/fundraiser-statistics/fundraiser-scripts/classes/FundraiserDataThreading.py (rev 0) +++ trunk/fundraiser-statistics/fundraiser-scripts/classes/FundraiserDataThreading.py 2011-06-12 01:42:26 UTC (rev 89902) @@ -0,0 +1,51 @@ +""" + +This module provides access to the threading classes for Fundraiser Analytics related tasks. +This is configured as a set of classes that extend the python threading classes to build +containers for multi-threading where needed + +""" + +__author__ = "Ryan Faulkner" +__revision__ = "$Rev$" +__date__ = "June 10th, 2011" + +import threading +import re +import Fundraiser_Tools.classes.DataMapper as DM + +""" + This class handles executing a log mining process in a new thread +""" +class MinerThread ( threading.Thread ): + + _fdm_ = None + _log_name_ = None + + def __init__(self, log_name): + threading.Thread.__init__(self) + self._fdm_ = DM.FundraiserDataMapper() + self._log_name_ = log_name + + def run( self ): + self.call_mine_log() + + def call_mine_log(self): + + if re.search('bannerImpressions', self._log_name_): + print 'New Thread: Mining banner impressions from ' + self._log_name_ + + try: + self._fdm_.mine_squid_impression_requests(self._log_name_ + '.log.gz') + except: + self._fdm_.mine_squid_impression_requests(self._log_name_ + '.log') + + elif re.search('landingpages', self._log_name_): + print 'New Thread: Mining landing page views from ' + self._log_name_ + + try: + self._fdm_.mine_squid_landing_page_requests(self._log_name_ + '.log.gz') + except: + self._fdm_.mine_squid_landing_page_requests(self._log_name_ + '.log') + + \ No newline at end of file _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs