コード例 #1
0
ファイル: DataCache_t.py プロジェクト: ramonbrugman/WMCore
    def testLatestJobDataExpired(self):
        self.assertFalse(DataCache.islatestJobDataExpired())

        DataCache.setDuration(-1)
        self.assertTrue(DataCache.islatestJobDataExpired())

        DataCache.setDuration(300)
        self.assertFalse(DataCache.islatestJobDataExpired())
        DataCache._lastedActiveDataFromAgent = {}
        self.assertTrue(DataCache.islatestJobDataExpired())

        self.assertEqual({}, DataCache.getlatestJobData())
コード例 #2
0
ファイル: DataCache_t.py プロジェクト: vkuznet/WMCore
    def testLatestJobDataExpired(self):
        self.assertFalse(DataCache.islatestJobDataExpired())

        DataCache.setDuration(-1)
        self.assertTrue(DataCache.islatestJobDataExpired())

        DataCache.setDuration(300)
        self.assertFalse(DataCache.islatestJobDataExpired())
        DataCache._lastedActiveDataFromAgent = {}
        self.assertTrue(DataCache.islatestJobDataExpired())

        self.assertEqual({}, DataCache.getlatestJobData())
コード例 #3
0
 def gatherT0ActiveDataStats(self, config):
     """
     gather active data statistics
     """
     try:
         if DataCache.islatestJobDataExpired():
             wmstatsDB = WMStatsReader(config.wmstats_url, reqdbURL=config.reqmgrdb_url,
                                       reqdbCouchApp = "T0Request")
             jobData = wmstatsDB.getT0ActiveData(jobInfoFlag = True)
             DataCache.setlatestJobData(jobData)
             self.logger.info("DataCache is updated: %s", len(jobData))
     except Exception as ex:
         self.logger.error(str(ex))
     return
コード例 #4
0
ファイル: DataCacheUpdate.py プロジェクト: lucacopa/WMCore
 def gatherActiveDataStats(self, config):
     """
     gather active data statistics
     """
     try:
         if DataCache.islatestJobDataExpired():
             wmstatsDB = WMStatsReader(config.wmstats_url, config.reqmgrdb_url, 
                                       reqdbCouchApp = "ReqMgr")
             jobData = wmstatsDB.getActiveData(jobInfoFlag = True)
             DataCache.setlatestJobData(jobData)
         
     except Exception as ex:
         cherrypy.log.error(str(ex))
     return
コード例 #5
0
 def gatherT0ActiveDataStats(self, config):
     """
     gather active data statistics
     """
     try:
         if DataCache.islatestJobDataExpired():
             wmstatsDB = WMStatsReader(config.wmstats_url, config.reqmgrdb_url, 
                                       reqdbCouchApp = "T0Request")
             jobData = wmstatsDB.getT0ActiveData(jobInfoFlag = True)
             DataCache.setlatestJobData(jobData)
             self.logger.info("DataCache is updated: %s" % len(jobData))
     except Exception as ex:
         self.logger.error(str(ex))
     return
コード例 #6
0
ファイル: DataCacheUpdate.py プロジェクト: lucacopa/WMCore
    def gatherActiveDataStats(self, config):
        """
        gather active data statistics
        """
        try:
            if DataCache.islatestJobDataExpired():
                wmstatsDB = WMStatsReader(config.wmstats_url,
                                          config.reqmgrdb_url,
                                          reqdbCouchApp="ReqMgr")
                jobData = wmstatsDB.getActiveData(jobInfoFlag=True)
                DataCache.setlatestJobData(jobData)

        except Exception as ex:
            cherrypy.log.error(str(ex))
        return
コード例 #7
0
def gatherActiveDataStats():
    wmstats_url = "https://cmsweb.cern.ch/couchdb/wmstats"
    reqmgrdb_url = "https://cmsweb.cern.ch/couchdb/reqmgr_workload_cache"
    jobInfoFlag = False
    tStart = time.time()
    try:
        if DataCache.islatestJobDataExpired():
            wmstatsDB = WMStatsReader(wmstats_url,
                                      reqdbURL=reqmgrdb_url,
                                      reqdbCouchApp="ReqMgr")
            jobData = wmstatsDB.getActiveData(jobInfoFlag=jobInfoFlag)
            DataCache.setlatestJobData(jobData)
            print("DataCache is updated: {}".format(len(jobData)))
        else:
            print("DataCache is up-to-date")
    except Exception as ex:
        print("Exception updating cache. Details: {}\nTraceback: {}".format(
            str(ex), str(traceback.format_exc())))
    print("Total time executing this cycle: {}".format(time.time() - tStart))
コード例 #8
0
 def gatherActiveDataStats(self, config):
     """
     gather active data statistics
     """
     self.logger.info("Starting gatherActiveDataStats with jobInfo set to: %s", self.getJobInfo)
     try:
         tStart = time.time()
         if DataCache.islatestJobDataExpired():
             wmstatsDB = WMStatsReader(config.wmstats_url, reqdbURL=config.reqmgrdb_url,
                                       reqdbCouchApp="ReqMgr", logger=self.logger)
             self.logger.info("Getting active data with job info for statuses: %s", WMSTATS_JOB_INFO)
             jobData = wmstatsDB.getActiveData(WMSTATS_JOB_INFO, jobInfoFlag=self.getJobInfo)
             self.logger.info("Getting active data with NO job info for statuses: %s", WMSTATS_NO_JOB_INFO)
             tempData = wmstatsDB.getActiveData(WMSTATS_NO_JOB_INFO, jobInfoFlag=False)
             jobData.update(tempData)
             self.logger.info("Running setlatestJobData...")
             DataCache.setlatestJobData(jobData)
             self.logger.info("DataCache is up-to-date with %d requests data", len(jobData))
     except Exception as ex:
         self.logger.exception("Exception updating DataCache. Error: %s", str(ex))
     self.logger.info("Total time loading data from ReqMgr2 and WMStats: %s", time.time() - tStart)
     return
コード例 #9
0
 def get(self):
     results = DataCache.getlatestJobData()
     if results == None or DataCache.islatestJobDataExpired():
         results = self.wmstats.getActiveData(jobInfoFlag = True)
     return rows([results])
コード例 #10
0
 def get(self):
     results = DataCache.getlatestJobData()
     if results == None or DataCache.islatestJobDataExpired():
         results = self.wmstats.getActiveData(jobInfoFlag=True)
     return rows([results])