Beispiel #1
0
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")
Beispiel #2
0
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")
Beispiel #3
0
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")
Beispiel #4
0
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")
Beispiel #5
0
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")
Beispiel #6
0
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")
Beispiel #7
0
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")
Beispiel #8
0
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")
Beispiel #9
0
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")
Beispiel #10
0
    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)
Beispiel #11
0
    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)