def getRequestInfoFromWMBS(serviceURL, jobStatusInfo): service = WMBS({'endpoint':serviceURL}) try: batchJobs = service.getBatchJobStatus() except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) return DFormatter.errorFormatter(serviceURL, "WMBS Service Dowtn")
def getRequestInfoFromWMBS(serviceURL, jobStatusInfo): service = WMBS({'endpoint':serviceURL}) try: batchJobs = service.getBatchJobStatus() except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) return DFormatter.errorFormatter(serviceURL, "WMBS Service Dowtn")
def getRequestInfoFromReqMgr(serviceURL): """ get the request info from requestManager """ service = RequestManager({"endpoint": serviceURL}) try: baseResults = service.getRequestNames() urls = service.getWorkQueue() except Exception, ex: logging.error(str(ex)) return DFormatter.errorFormatter(serviceURL, "RequestManger Down")
def getRequestInfoFromLocalQueue(serviceURL): """ get the request info from local queue """ url, dbName = splitCouchServiceURL(serviceURL) service = WorkQueue(url, dbName) try: wmbsUrls = service.getWMBSUrl() jobStatusInfo = service.getJobInjectStatusByRequest() except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) return DFormatter.errorFormatter(serviceURL, "LocalQueue Down")
def getRequestInfoFromLocalQueue(serviceURL): """ get the request info from local queue """ url, dbName = splitCouchServiceURL(serviceURL) service = WorkQueue(url, dbName) try: wmbsUrls = service.getWMBSUrl() jobStatusInfo = service.getJobInjectStatusByRequest() except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) return DFormatter.errorFormatter(serviceURL, "LocalQueue Down")
def getRequestInfoFromGlobalQueue(serviceURL): """ get the request info from global queue """ url, dbName = splitCouchServiceURL(serviceURL) service = WorkQueue(url, dbName) try: jobInfo = service.getTopLevelJobsByRequest() qInfo = service.getChildQueuesByRequest() siteWhitelists = service.getSiteWhitelistByRequest() childQueueURLs = set() for item in qInfo: childQueueURLs.add(item['local_queue']) except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) return DFormatter.errorFormatter(serviceURL, "GlobalQueue Down")
def getRequestInfoFromGlobalQueue(serviceURL): """ get the request info from global queue """ url, dbName = splitCouchServiceURL(serviceURL) service = WorkQueue(url, dbName) try: jobInfo = service.getTopLevelJobsByRequest() qInfo = service.getChildQueuesByRequest() siteWhitelists = service.getSiteWhitelistByRequest() childQueueURLs = set() for item in qInfo: childQueueURLs.add(item['local_queue']) except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) return DFormatter.errorFormatter(serviceURL, "GlobalQueue Down")
def getRequestInfoFromReqMgr(serviceURL): """ get the request info from requestManager """ ###TODO: add back when GlobalMonitor spins out as a separate application service = RequestManager({'endpoint':serviceURL}) try: ### use request manager funtion directly ### TODO: remove this when GlobalMonitor spins out as a separate application if serviceURL.lower() == "local": baseResults = getOverview() urls = getGlobalQueues() else: baseResults = service.getRequestNames() urls = service.getWorkQueue() except Exception, ex: logging.error(str(ex)) return DFormatter.errorFormatter(serviceURL, "RequestManger Down")
def getRequestInfoFromReqMgr(serviceURL): """ get the request info from requestManager """ ###TODO: add back when GlobalMonitor spins out as a separate application service = RequestManager({'endpoint':serviceURL}) try: ### use request manager funtion directly ### TODO: remove this when GlobalMonitor spins out as a separate application if serviceURL.lower() == "local": baseResults = getOverview() urls = getGlobalQueues() else: baseResults = service.getRequestNames() urls = service.getWorkQueue() except Exception, ex: logging.error(str(ex)) return DFormatter.errorFormatter(serviceURL, "RequestManger Down")
if wmbsUrls: return getRequestInfoFromWMBS(wmbsUrls[0], jobStatusInfo) else: return [] def getRequestInfoFromWMBS(serviceURL, jobStatusInfo): service = WMBS({'endpoint':serviceURL}) try: batchJobs = service.getBatchJobStatus() except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) return DFormatter.errorFormatter(serviceURL, "WMBS Service Dowtn") try: couchJobs = service.getJobSummaryFromCouchDB() # this should be only CouchError, since localQueue error should be # caught above try except. doesn't try to catch CouchError to # reduce the dependency (not to import CouchError) except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) couchJobs = DFormatter.errorFormatter(serviceURL, "CouchDB Down") else: if len(couchJobs) == 1 and couchJobs[0].has_key("error"): couchJobs = DFormatter.errorFormatter(serviceURL, couchJobs[0]['error']) baseResults = combineListOfDict('request_name', jobStatusInfo, couchJobs) return combineListOfDict('request_name', baseResults, batchJobs)
if wmbsUrls: return getRequestInfoFromWMBS(wmbsUrls[0], jobStatusInfo) else: return [] def getRequestInfoFromWMBS(serviceURL, jobStatusInfo): service = WMBS({'endpoint':serviceURL}) try: batchJobs = service.getBatchJobStatus() except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) return DFormatter.errorFormatter(serviceURL, "WMBS Service Dowtn") try: couchJobs = service.getJobSummaryFromCouchDB() # this should be only CouchError, since localQueue error should be # caught above try except. doesn't try to catch CouchError to # reduce the dependency (not to import CouchError) except Exception, ex: logging.error("%s: %s" % (serviceURL, str(ex))) couchJobs = DFormatter.errorFormatter(serviceURL, "CouchDB Down") else: if len(couchJobs) == 1 and couchJobs[0].has_key("error"): couchJobs = DFormatter.errorFormatter(serviceURL, couchJobs[0]['error']) baseResults = combineListOfDict('request_name', jobStatusInfo, couchJobs) return combineListOfDict('request_name', baseResults, batchJobs)