예제 #1
0
def get_from_queue(queue_name, xqueue_session):
    """ Get a single submission from xqueue """
    try:
        success, response = util._http_get(xqueue_session, urllib.parse.urljoin(settings.XQUEUE_INTERFACE['url'], urls.XqueueURLs.get_submission), {'queue_name': queue_name})
    except Exception as err:
        return False, "Error getting response: {0}".format(err)

    return success, response
예제 #2
0
def get_queue_length(queue_name, xqueue_session):
    """ Returns the length of the queue """
    try:
        success, response = util._http_get(xqueue_session, urllib.parse.urljoin(settings.XQUEUE_INTERFACE['url'], urls.XqueueURLs.get_queuelen), {'queue_name': queue_name})
        if not success:
            return False, "Invalid return code in reply"
    except Exception as e:
        log.critical("Unable to get queue length: {0}".format(e))
        return False, "Unable to get queue length."

    return True, response
def get_from_queue(queue_name,xqueue_session):
    """
        Get a single submission from xqueue
        """
    try:
        success, response = util._http_get(xqueue_session,
                                           urlparse.urljoin(settings.XQUEUE_INTERFACE['url'], project_urls.XqueueURLs.get_submission),
                                           {'queue_name': queue_name})
    except Exception as err:
        return False, "Error getting response: {0}".format(err)
    
    return success, response
def get_queue_length(queue_name,xqueue_session):
    """
        Returns the length of the queue
        """
    try:
        success, response = util._http_get(xqueue_session,
                                           urlparse.urljoin(settings.XQUEUE_INTERFACE['url'], project_urls.XqueueURLs.get_queuelen),
                                           {'queue_name': queue_name})
        
        if not success:
            return False,"Invalid return code in reply"
    
    except Exception as e:
        log.critical("Unable to get queue length: {0}".format(e))
        return False, "Unable to get queue length."
    
    return True, response