本文整理汇总了Python中WMCore.RequestManager.RequestDB.Interface.Admin.ProdManagement类的典型用法代码示例。如果您正苦于以下问题:Python ProdManagement类的具体用法?Python ProdManagement怎么用?Python ProdManagement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProdManagement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: one
def one(self, requestName):
""" Assign a single request """
self.validate(requestName)
request = GetRequest.getRequestByName(requestName)
request = Utilities.prepareForTable(request)
requestType = request["RequestType"]
# get assignments
teams = ProdManagement.listTeams()
assignments = GetRequest.getAssignmentsByName(requestName)
# might be a list, or a dict team:priority
if isinstance(assignments, dict):
assignments = assignments.keys()
procVer = ""
acqEra = ""
helper = Utilities.loadWorkload(request)
if helper.getAcquisitionEra() != None:
acqEra = helper.getAcquisitionEra()
if helper.getProcessingVersion() != None:
procVer = helper.getProcessingVersion()
dashboardActivity = helper.getDashboardActivity()
(reqMergedBase, reqUnmergedBase) = helper.getLFNBases()
return self.templatepage("Assign", requests=[request], teams=teams,
assignments=assignments, sites=self.sites,
mergedLFNBases=self.mergedLFNBases[requestType],
reqMergedBase=reqMergedBase,
unmergedLFNBases=self.allUnmergedLFNBases,
reqUnmergedBase=reqUnmergedBase,
acqEra = acqEra, procVer = procVer,
dashboardActivity=dashboardActivity,
badRequests=[])
示例2: changePriority
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: getWorkQueue
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: abortRequest
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: putAssignment
def putAssignment(self, team, requestName):
""" Assigns this request to this team """
# see if it's already assigned
team = urllib.unquote(team)
if not team in ProdManagement.listTeams():
raise cherrypy.HTTPError(404,"Cannot find this team")
requestNamesAndIDs = ListRequests.listRequestsByTeam(team)
if requestName in requestNamesAndIDs.keys():
raise cherrypy.HTTPError(400,"Already assigned to this team")
return ChangeState.assignRequest(requestName, team)
示例6: abortRequest
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: one
def one(self, requestName):
""" Assign a single request """
self.validate(requestName)
request = GetRequest.getRequestByName(requestName)
request = Utilities.prepareForTable(request)
# get assignments
teams = ProdManagement.listTeams()
assignments = GetRequest.getAssignmentsByName(requestName)
# might be a list, or a dict team:priority
if isinstance(assignments, dict):
assignments = assignments.keys()
procVer = ""
acqEra = ""
procString = ""
helper = Utilities.loadWorkload(request)
if helper.getAcquisitionEra() != None:
acqEra = helper.getAcquisitionEra()
if helper.getProcessingVersion() != None:
procVer = helper.getProcessingVersion()
if helper.getProcessingString():
procString = helper.getProcessingString()
dashboardActivity = helper.getDashboardActivity()
blockCloseMaxWaitTime = helper.getBlockCloseMaxWaitTime()
blockCloseMaxFiles = helper.getBlockCloseMaxFiles()
blockCloseMaxEvents = helper.getBlockCloseMaxEvents()
blockCloseMaxSize = helper.getBlockCloseMaxSize()
(reqMergedBase, reqUnmergedBase) = helper.getLFNBases()
return self.templatepage(
"Assign",
requests=[request],
teams=teams,
assignments=assignments,
sites=self.sites,
phedexNodes=self.phedexNodes,
mergedLFNBases=self.allMergedLFNBases,
reqMergedBase=reqMergedBase,
unmergedLFNBases=self.allUnmergedLFNBases,
reqUnmergedBase=reqUnmergedBase,
acqEra=acqEra,
procVer=procVer,
procString=procString,
dashboardActivity=dashboardActivity,
badRequests=[],
blockCloseMaxWaitTime=blockCloseMaxWaitTime,
blockCloseMaxFiles=blockCloseMaxFiles,
blockCloseMaxSize=blockCloseMaxSize,
blockCloseMaxEvents=blockCloseMaxEvents,
)
示例8: index
def index(self, all=0):
""" Main page """
# returns dict of name:id
allRequests = Utilities.requestsWithStatus("assignment-approved")
teams = ProdManagement.listTeams()
procVer = ""
acqEra = ""
procString = ""
dashboardActivity = None
badRequestNames = []
goodRequests = []
reqMergedBase = None
reqUnmergedBase = None
blockCloseMaxWaitTime = 66400
blockCloseMaxFiles = 500
blockCloseMaxEvents = 250000000
blockCloseMaxSize = 5000000000000
for request in allRequests:
# make sure there's a workload attached
try:
helper = Utilities.loadWorkload(request)
except Exception, ex:
logging.error("Assign error: %s " % str(ex))
badRequestNames.append(request["RequestName"])
else:
# get defaults from the first good one
if not goodRequests:
# forget it if it fails.
try:
if helper.getAcquisitionEra() != None:
acqEra = helper.getAcquisitionEra()
if helper.getProcessingVersion() != None:
procVer = helper.getProcessingVersion()
if helper.getProcessingString() != None:
procString = helper.getProcessingString()
blockCloseMaxWaitTime = helper.getBlockCloseMaxWaitTime()
blockCloseMaxFiles = helper.getBlockCloseMaxFiles()
blockCloseMaxEvents = helper.getBlockCloseMaxEvents()
blockCloseMaxSize = helper.getBlockCloseMaxSize()
(reqMergedBase, reqUnmergedBase) = helper.getLFNBases()
dashboardActivity = helper.getDashboardActivity()
goodRequests.append(request)
except Exception, ex:
logging.error("Assign error: %s " % str(ex))
badRequestNames.append(request["RequestName"])
else:
示例9: index
def index(self, all=0):
""" Main page """
# returns dict of name:id
allRequests = Utilities.requestsWithStatus('assignment-approved')
teams = ProdManagement.listTeams()
procVer = ""
acqEra = ""
dashboardActivity = None
badRequestNames = []
goodRequests = []
reqMergedBase = None
reqUnmergedBase = None
for request in allRequests:
# make sure there's a workload attached
try:
helper = Utilities.loadWorkload(request)
except:
badRequestNames.append(request["RequestName"])
else:
# get defaults from the first good one
if not goodRequests:
if helper.getAcquisitionEra() != None:
acqEra = helper.getAcquisitionEra()
if helper.getProcessingVersion() != None:
procVer = helper.getProcessingVersion()
(reqMergedBase, reqUnmergedBase) = helper.getLFNBases()
dashboardActivity = helper.getDashboardActivity()
goodRequests.append(request)
return self.templatepage("Assign", all=all, requests=goodRequests, teams=teams,
assignments=[], sites=self.sites,
mergedLFNBases=self.allMergedLFNBases,
reqMergedBase=reqMergedBase,
unmergedLFNBases=self.allUnmergedLFNBases,
reqUnmergedBase=reqUnmergedBase,
acqEra = acqEra, procVer = procVer,
dashboardActivity=dashboardActivity,
badRequests=badRequestNames)
示例10: deleteTeam
def deleteTeam(self, team):
""" Delete this team from ReqMgr """
ProdManagement.removeTeam(urllib.unquote(team))
示例11: putTeam
def putTeam(self, team):
""" Registers a team with ReqMgr """
return ProdManagement.addTeam(urllib.unquote(team))
示例12: putWorkQueue
def putWorkQueue(self, request, url):
""" Registers the request as "acquired" by the workqueue with the given URL """
Utilities.changeStatus(request, "acquired", self.wmstatWriteURL, self.acdcURL)
return ProdManagement.associateProdMgr(request, urllib.unquote(url))
示例13: getTeam
def getTeam(self):
""" Returns a list of all teams registered with ReqMgr """
return ProdManagement.listTeams()
示例14: index
def index(self, all=0):
""" Main page """
# returns dict of name:id
allRequests = Utilities.requestsWithStatus("assignment-approved")
teams = ProdManagement.listTeams()
procVer = ""
acqEra = ""
procString = ""
dashboardActivity = None
badRequestNames = []
goodRequests = allRequests
reqMergedBase = None
reqUnmergedBase = None
blockCloseMaxWaitTime = 66400
blockCloseMaxFiles = 500
blockCloseMaxEvents = 250000000
blockCloseMaxSize = 5000000000000
# for request in allRequests:
# # make sure there's a workload attached
# try:
# helper = Utilities.loadWorkload(request)
# except Exception, ex:
# logging.error("Assign error: %s " % str(ex))
# badRequestNames.append(request["RequestName"])
# else:
# # get defaults from the first good one
# if not goodRequests:
# # forget it if it fails.
# try:
# if helper.getAcquisitionEra() != None:
# acqEra = helper.getAcquisitionEra()
# if helper.getProcessingVersion() != None:
# procVer = helper.getProcessingVersion()
# if helper.getProcessingString() != None:
# procString = helper.getProcessingString()
# blockCloseMaxWaitTime = helper.getBlockCloseMaxWaitTime()
# blockCloseMaxFiles = helper.getBlockCloseMaxFiles()
# blockCloseMaxEvents = helper.getBlockCloseMaxEvents()
# blockCloseMaxSize = helper.getBlockCloseMaxSize()
# (reqMergedBase, reqUnmergedBase) = helper.getLFNBases()
# dashboardActivity = helper.getDashboardActivity()
# goodRequests.append(request)
# except Exception, ex:
# logging.error("Assign error: %s " % str(ex))
# badRequestNames.append(request["RequestName"])
# else:
# goodRequests.append(request)
return self.templatepage(
"Assign",
all=all,
requests=goodRequests,
teams=teams,
assignments=[],
sites=self.sites,
phedexNodes=self.phedexNodes,
mergedLFNBases=self.allMergedLFNBases,
reqMergedBase=reqMergedBase,
unmergedLFNBases=self.allUnmergedLFNBases,
reqUnmergedBase=reqUnmergedBase,
acqEra=acqEra,
procVer=procVer,
procString=procString,
dashboardActivity=dashboardActivity,
badRequests=badRequestNames,
blockCloseMaxWaitTime=blockCloseMaxWaitTime,
blockCloseMaxFiles=blockCloseMaxFiles,
blockCloseMaxSize=blockCloseMaxSize,
blockCloseMaxEvents=blockCloseMaxEvents,
)
示例15: handleAddTeam
def handleAddTeam(self, team):
""" Handles a request to add a team """
self.validate(team)
ProdManagement.addTeam(team)
return "Added team %s" % team