예제 #1
0
def changePriority(requestName, priority, wmstatUrl = None):
    """
    Changes the priority that's stored in the workload.
    Takes the current priority stored in the workload and adds
    to it the input priority value. 
    
    """
    request = requestDetails(requestName)
    # change in Oracle
    newPrior = int(priority)
    ChangeState.changeRequestPriority(requestName, newPrior)
    # change in workload (spec)
    helper = loadWorkload(request)
    helper.data.request.priority = newPrior
    saveWorkload(helper, request['RequestWorkflow'], wmstatUrl)
    # change priority in CouchDB
    couchDb = Database(request["CouchWorkloadDBName"], request["CouchURL"])
    fields = {"RequestPriority": newPrior}
    couchDb.updateDocument(requestName, "ReqMgr", "updaterequest", fields=fields)
    # push the change to the WorkQueue
    response = ProdManagement.getProdMgr(requestName)
    if response == [] or response[0] is None or response[0] == "":
        # Request must not be assigned yet, we are safe here
        return
    workqueue = WorkQueue.WorkQueue(response[0])
    workqueue.updatePriority(requestName, priority)
    return
예제 #2
0
def changePriority(requestName, priority, wmstatUrl = None):
    """
    Changes the priority that's stored in the workload.
    Takes the current priority stored in the workload and adds
    to it the input priority value. 
    
    """
    request = requestDetails(requestName)
    # change in Oracle
    newPrior = int(priority)
    ChangeState.changeRequestPriority(requestName, newPrior)
    # change in workload (spec)
    helper = loadWorkload(request)
    helper.data.request.priority = newPrior
    saveWorkload(helper, request['RequestWorkflow'], wmstatUrl)
    # change priority in CouchDB
    couchDb = Database(request["CouchWorkloadDBName"], request["CouchURL"])
    fields = {"RequestPriority": newPrior}
    couchDb.updateDocument(requestName, "ReqMgr", "updaterequest", fields=fields)
    # push the change to the WorkQueue
    response = ProdManagement.getProdMgr(requestName)
    if response == [] or response[0] is None or response[0] == "":
        # Request must not be assigned yet, we are safe here
        return
    workqueue = WorkQueue.WorkQueue(response[0])
    workqueue.updatePriority(requestName, priority)
    return
예제 #3
0
 def getWorkQueue(self, request=None, workQueue=None):
     """ If a request is passed in, return the URl of the workqueue.
     If a workqueue is passed in, return all requests acquired by it """
     if workQueue != None:
         return ProdMgrRetrieve.findAssignedRequests(workQueue)
     if request != None:
         return ProdManagement.getProdMgr(request)
     # return all the workqueue ulr
     return GetRequest.getGlobalQueues()
예제 #4
0
def abortRequest(request):
    """ Changes the state of the request to "aborted", and asks the work queue
    to cancel its work """
    response = ProdManagement.getProdMgr(request)
    url = response[0]
    if url == None or url == "":
        raise cherrypy.HTTPError(400, "Cannot find URL for request " + request)
    workqueue = WorkQueue.WorkQueue(url)
    workqueue.cancelWorkflow(request)
예제 #5
0
 def getWorkQueue(self, request=None, workQueue=None):
     """ If a request is passed in, return the URl of the workqueue.
     If a workqueue is passed in, return all requests acquired by it """
     if workQueue != None:
         return ProdMgrRetrieve.findAssignedRequests(workQueue)
     if request != None:
         return ProdManagement.getProdMgr(request)
     # return all the workqueue ulr
     return GetRequest.getGlobalQueues()
예제 #6
0
def abortRequest(requestName):
    """ Changes the state of the request to "aborted", and asks the work queue
    to cancel its work """
    response = ProdManagement.getProdMgr(requestName)
    if response == [] or response[0] == None or response[0] == "":
        msg = "Cannot find ProdMgr for request %s\n " % requestName
        msg += "Request may not be known to WorkQueue.  If aborted immediately after assignment, ignore this."
        raise cherrypy.HTTPError(400, msg)
    workqueue = WorkQueue.WorkQueue(response[0])
    workqueue.cancelWorkflow(requestName)
    return
예제 #7
0
def abortRequest(requestName):
    """ Changes the state of the request to "aborted", and asks the work queue
    to cancel its work """
    response = ProdManagement.getProdMgr(requestName)
    if response == [] or response[0] == None or response[0] == "":
        msg =  "Cannot find ProdMgr for request %s\n " % requestName
        msg += "Request may not be known to WorkQueue.  If aborted immediately after assignment, ignore this."
        raise cherrypy.HTTPError(400, msg)
    workqueue = WorkQueue.WorkQueue(response[0])
    workqueue.cancelWorkflow(requestName)
    return