http://www.mediawiki.org/wiki/Special:Code/MediaWiki/91003
Revision: 91003 Author: rfaulk Date: 2011-06-28 21:17:58 +0000 (Tue, 28 Jun 2011) Log Message: ----------- setup miner thread execution for performing squid log mining Modified Paths: -------------- trunk/fundraiser-statistics/fundraiser-scripts/classes/FundraiserDataThreading.py Modified: trunk/fundraiser-statistics/fundraiser-scripts/classes/FundraiserDataThreading.py =================================================================== --- trunk/fundraiser-statistics/fundraiser-scripts/classes/FundraiserDataThreading.py 2011-06-28 21:16:39 UTC (rev 91002) +++ trunk/fundraiser-statistics/fundraiser-scripts/classes/FundraiserDataThreading.py 2011-06-28 21:17:58 UTC (rev 91003) @@ -29,23 +29,64 @@ def run( self ): self.call_mine_log() - + + + def call_copy_log(self, type, **kwargs): + + return + def call_mine_log(self): - + + dm = DM.DataMapper() + + """ Determine whether logs are for banner impressions or landing pages """ + 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') + if dm.log_exists(self._log_name_ + '.log.gz'): + try: + self._fdm_.mine_squid_impression_requests(self._log_name_ + '.log.gz') + + except Exception as e: + print type(e) # the exception instance + print e.args # arguments stored in .args + print e # __str__ allows args to printed directly + + + elif dm.log_exists(self._log_name_ + '.log'): + + try: + self._fdm_.mine_squid_impression_requests(self._log_name_ + '.log') + + except Exception as e: + print type(e) # the exception instance + print e.args # arguments stored in .args + print e # __str__ allows args to printed directly + + 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') - + if dm.log_exists(self._log_name_ + '.log.gz'): + + try: + self._fdm_.mine_squid_landing_page_requests(self._log_name_ + '.log.gz') + + except Exception as e: + print type(e) # the exception instance + print e.args # arguments stored in .args + print e # __str__ allows args to printed directly + + elif dm.log_exists(self._log_name_ + '.log'): + + try: + self._fdm_.mine_squid_landing_page_requests(self._log_name_ + '.log') + + except Exception as e: + print type(e) # the exception instance + print e.args # arguments stored in .args + print e # __str__ allows args to printed directly + \ No newline at end of file _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs