def testC_StatWork_testDocRemovalFromRuntimeDB(self): """ _StatWork_BasicFunctionTest_ Test statisticWorker, by seeing if it can remove an expired doc from runtimeDB. """ doc = self.createTestFileFinishedYesterdayinFilesDB( ) statWorker = StatisticDaemon(config = self.config) statWorker.algorithm( ) query = {'reduce':False, 'key':[doc['user'], doc['destination'], doc['source'], doc['dn'] ] } active_files = self.db.loadView('AsyncTransfer', 'ftscp', query)['rows'] assert len(active_files) == 0
def testD_StatWork_testNumberOfDocsPerIteration(self): """ _StatWork_testNumberOfDocsPerIteration_ Test if the stat daemon creates a new document per iteration """ self.createTestFileFinishedYesterdayinFilesDB( ) statWorker = StatisticDaemon(config = self.config) statWorker.algorithm( ) self.createTestFileFinishedYesterdayinFilesDB( ) statWorker = StatisticDaemon(config = self.config) statWorker.algorithm( ) query = {} serverRows = self.dbStat.loadView('stat', 'ftservers', query)['rows'] assert len(serverRows) == 2
def preInitialization(self): """ Add required worker modules to work threads """ logging.debug(self.config) myThread = threading.currentThread() logging.debug("Setting component poll interval to %s seconds" \ %str(self.config.Statistics.pollStatInterval) ) myThread.workerThreadManager.addWorker( \ StatisticDaemon(self.config), \ self.config.Statistics.pollStatInterval \ ) return