本文整理汇总了Python中WMCore.RequestManager.RequestDB.Interface.Request.ChangeState.changeRequestStatus方法的典型用法代码示例。如果您正苦于以下问题:Python ChangeState.changeRequestStatus方法的具体用法?Python ChangeState.changeRequestStatus怎么用?Python ChangeState.changeRequestStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.RequestManager.RequestDB.Interface.Request.ChangeState
的用法示例。
在下文中一共展示了ChangeState.changeRequestStatus方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: changeStatus
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def changeStatus(requestName, status, wmstatUrl, acdcUrl):
""" Changes the status for this request """
request = GetRequest.getRequestByName(requestName)
if not status in RequestStatus.StatusList:
raise RuntimeError("Bad status code " + status)
if 'RequestStatus' not in request:
raise RuntimeError("Cannot find status for request " + requestName)
oldStatus = request['RequestStatus']
if not status in RequestStatus.NextStatus[oldStatus]:
raise RuntimeError("Cannot change status from %s to %s. Allowed values are %s" % (
oldStatus, status, RequestStatus.NextStatus[oldStatus]))
if status == 'aborted' or status == 'force-complete':
# delete from the workqueue
if not privileged() and not ownsRequest(request):
raise cherrypy.HTTPError(403, "You are not allowed to %s this request" % status)
elif not privileged():
raise cherrypy.HTTPError(403, "You are not allowed to change the state for this request")
# delete from the workqueue if it's been assigned to one
if status in RequestStatus.NextStatus[oldStatus]:
abortRequest(requestName)
else:
raise cherrypy.HTTPError(400, "You cannot abort a request in state %s" % oldStatus)
# ACDC database is cleaned by separate thread
# if status == 'announced':
# # cleanup acdc database, if possible
# if acdcUrl:
# url, database = WMCore.Lexicon.splitCouchServiceURL(acdcUrl)
# acdcService = CouchService(url = url, database = database)
# acdcService.removeFilesetsByCollectionName(requestName)
# finally, perform the transition, have to do it in both Oracle and CouchDB
# and in WMStats
ChangeState.changeRequestStatus(requestName, status, wmstatUrl=wmstatUrl)
示例2: changeStatus
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def changeStatus(requestName, status, wmstatUrl):
""" Changes the status for this request """
request = GetRequest.getRequestByName(requestName)
if not status in RequestStatus.StatusList:
raise RuntimeError, "Bad status code " + status
if not request.has_key('RequestStatus'):
raise RuntimeError, "Cannot find status for request " + requestName
oldStatus = request['RequestStatus']
if not status in RequestStatus.NextStatus[oldStatus]:
raise RuntimeError, "Cannot change status from %s to %s. Allowed values are %s" % (
oldStatus, status, RequestStatus.NextStatus[oldStatus])
if status == 'aborted':
# delete from the workqueue
if not privileged() and not ownsRequest(request):
raise cherrypy.HTTPError(403, "You are not allowed to abort this request")
elif not privileged():
raise cherrypy.HTTPError(403, "You are not allowed to change the state for this request")
# delete from the workqueue if it's been assigned to one
if oldStatus in ["acquired", "running"]:
abortRequest(requestName)
else:
raise cherrypy.HTTPError(400, "You cannot abort a request in state %s" % oldStatus)
#FIXME needs logic about who is allowed to do which transition
ChangeState.changeRequestStatus(requestName, status, wmstatUrl = wmstatUrl)
return
示例3: changeStatus
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def changeStatus(requestName, status, wmstatUrl, acdcUrl):
""" Changes the status for this request """
request = GetRequest.getRequestByName(requestName)
if not status in RequestStatus.StatusList:
raise RuntimeError, "Bad status code " + status
if not request.has_key('RequestStatus'):
raise RuntimeError, "Cannot find status for request " + requestName
oldStatus = request['RequestStatus']
if not status in RequestStatus.NextStatus[oldStatus]:
raise RuntimeError, "Cannot change status from %s to %s. Allowed values are %s" % (
oldStatus, status, RequestStatus.NextStatus[oldStatus])
if status == 'aborted':
# delete from the workqueue
if not privileged() and not ownsRequest(request):
raise cherrypy.HTTPError(403, "You are not allowed to abort this request")
elif not privileged():
raise cherrypy.HTTPError(403, "You are not allowed to change the state for this request")
# delete from the workqueue if it's been assigned to one
if oldStatus in ["acquired", "running", "running-closed", "running-open"]:
abortRequest(requestName)
else:
raise cherrypy.HTTPError(400, "You cannot abort a request in state %s" % oldStatus)
if status == 'announced':
# cleanup acdc database, if possible
if acdcUrl:
url, database = WMCore.Lexicon.splitCouchServiceURL(acdcUrl)
acdcService = CouchService(url = url, database = database)
acdcService.removeFilesetsByCollectionName(requestName)
# finally, perform the transition, have to do it in both Oracle and CouchDB
# and in WMStats
ChangeState.changeRequestStatus(requestName, status, wmstatUrl=wmstatUrl)
示例4: handleCloseOut
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def handleCloseOut(self, **kwargs):
""" Handler for closing out requests """
requests = BulkOperations.requestNamesFromCheckboxes(self, kwargs)
for requestName in requests:
WMCore.Lexicon.identifier(requestName)
ChangeState.changeRequestStatus(requestName, 'closed-out', wmstatUrl = self.wmstatWriteURL)
return self.templatepage("Acknowledge", participle="closed out",
requests=requests)
示例5: handleAssignmentPage
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def handleAssignmentPage(self, **kwargs):
""" handler for the main page """
#Accept Json encoded strings
decodedArgs = {}
for key in kwargs.keys():
try:
decodedArgs[key] = JsonWrapper.loads(kwargs[key])
except:
#Probably wasn't JSON
decodedArgs[key] = kwargs[key]
kwargs = decodedArgs
# handle the checkboxes
teams = []
requestNames = []
for key, value in kwargs.iteritems():
if isinstance(value, types.StringTypes):
kwargs[key] = value.strip()
if key.startswith("Team"):
teams.append(key[4:])
if key.startswith("checkbox"):
requestName = key[8:]
self.validate(requestName)
requestNames.append(key[8:])
for requestName in requestNames:
if kwargs['action'] == 'Reject':
ChangeState.changeRequestStatus(requestName, 'rejected', wmstatUrl = self.wmstatWriteURL)
else:
assignments = GetRequest.getAssignmentsByName(requestName)
if teams == [] and assignments == []:
raise cherrypy.HTTPError(400, "Must assign to one or more teams")
self.assignWorkload(requestName, kwargs)
for team in teams:
if not team in assignments:
ChangeState.assignRequest(requestName, team, wmstatUrl = self.wmstatWriteURL)
priority = kwargs.get(requestName+':priority', '')
if priority != '':
Utilities.changePriority(requestName, priority, self.wmstatWriteURL)
participle=kwargs['action']+'ed'
if self.opshold and kwargs['action'] == 'Assign':
participle='put into "ops-hold" state (see <a href="%s">OpsClipboard</a>)' % self.clipboardUrl
# this, previously used, call made all requests injected into OpsClipboard to
# have campaign_id null since the call doesn't propagate request's
# CampaignName at all, AcquisitionEra remains default null and probably
# a bunch of other things is wrong too
#requests = [GetRequest.getRequestByName(requestName) for requestName in requestNames]
requests = [Utilities.requestDetails(requestName) for requestName in requestNames]
OpsClipboard.inject(self.couchUrl, self.clipboardDB, *requests)
for request in requestNames:
ChangeState.changeRequestStatus(requestName, 'ops-hold', wmstatUrl = self.wmstatWriteURL)
return self.templatepage("Acknowledge", participle=participle, requests=requestNames)
示例6: changeStatus
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def changeStatus(requestName, status):
""" Changes the status for this request """
request = GetRequest.getRequestByName(requestName)
oldStatus = request['RequestStatus']
if not status in RequestStatus.StatusList:
raise RuntimeError, "Bad status code " + status
if not request.has_key('RequestStatus'):
raise RuntimeError, "Cannot find status for request " + requestName
if not status in RequestStatus.NextStatus[oldStatus]:
raise RuntimeError, "Cannot change status from %s to %s. Allowed values are %s" % (
oldStatus, status, RequestStatus.NextStatus[oldStatus])
ChangeState.changeRequestStatus(requestName, status)
if status == 'aborted':
# delete from the workqueue
abortRequest(requestName)
示例7: handleApprove
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def handleApprove(self, **kwargs):
""" Handler for approving requests """
requests = self.requestNamesFromCheckboxes(kwargs)
particple = ''
for requestName in requests:
if kwargs['action'] == 'Reject':
participle = 'rejected'
ChangeState.changeRequestStatus(requestName, 'rejected', wmstatUrl = self.wmstatWriteURL)
else:
participle = 'approved'
ChangeState.changeRequestStatus(requestName, 'assignment-approved', wmstatUrl = self.wmstatWriteURL)
priority = kwargs.get(requestName+':priority', '')
if priority != '':
Utilities.changePriority(requestName, priority, self.wmstatWriteURL)
return self.templatepage("Acknowledge", participle=participle,
requests=requests)
示例8: handleAssignmentPage
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def handleAssignmentPage(self, **kwargs):
""" handler for the main page """
# Accept Json encoded strings
decodedArgs = {}
for key in kwargs.keys():
try:
decodedArgs[key] = JsonWrapper.loads(kwargs[key])
except Exception:
# Probably wasn't JSON
decodedArgs[key] = kwargs[key]
kwargs = decodedArgs
# handle the checkboxes
teams = []
requestNames = []
for key, value in kwargs.iteritems():
if isinstance(value, basestring):
kwargs[key] = value.strip()
if key.startswith("Team"):
teams.append(key[4:])
if key.startswith("checkbox"):
requestName = key[8:]
self.validate(requestName)
requestNames.append(key[8:])
for requestName in requestNames:
if kwargs["action"] == "Reject":
ChangeState.changeRequestStatus(requestName, "rejected", wmstatUrl=self.wmstatWriteURL)
else:
assignments = GetRequest.getAssignmentsByName(requestName)
if teams == [] and assignments == []:
raise cherrypy.HTTPError(400, "Must assign to one or more teams")
kwargs["Teams"] = teams
self.assignWorkload(requestName, kwargs)
for team in teams:
if not team in assignments:
ChangeState.assignRequest(requestName, team, wmstatUrl=self.wmstatWriteURL)
priority = kwargs.get(requestName + ":priority", "")
if priority != "":
Utilities.changePriority(requestName, priority, self.wmstatWriteURL)
participle = kwargs["action"] + "ed"
return self.templatepage("Acknowledge", participle=participle, requests=requestNames)
示例9: handleAnnounce
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def handleAnnounce(self, **kwargs):
""" Handler for announcing requests """
requests = self.requestNamesFromCheckboxes(kwargs)
datasets = []
goodDatasets = []
badDatasets = []
for requestName in requests:
WMCore.Lexicon.identifier(requestName)
ChangeState.changeRequestStatus(requestName, 'announced', wmstatUrl = self.wmstatWriteURL)
datasets.extend(Utilities.getOutputForRequest(requestName))
for dataset in datasets:
try:
toks = dataset.split('/')
data = {'primary_ds_name': toks[0], 'processed_ds_name': toks[1],
'data_tier_name': toks[2], 'is_dataset_valid': 1}
dbsSender.post('/DBSWriter/datasets', data=data)
goodDatasets.append(dataset)
except:
logging.warning("Could not update dataset into DBS:" +dataset)
badDatasets.append(dataset)
return self.templatepage("Announce", requests=requests,
goodDatasets=goodDatasets,
badDatasets=badDatasets)
示例10: handleAssignmentPage
# 需要导入模块: from WMCore.RequestManager.RequestDB.Interface.Request import ChangeState [as 别名]
# 或者: from WMCore.RequestManager.RequestDB.Interface.Request.ChangeState import changeRequestStatus [as 别名]
def handleAssignmentPage(self, **kwargs):
""" handler for the main page """
# handle the checkboxes
teams = []
requestNames = []
for key, value in kwargs.iteritems():
if isinstance(value, types.StringTypes):
kwargs[key] = value.strip()
if key.startswith("Team"):
teams.append(key[4:])
if key.startswith("checkbox"):
requestName = key[8:]
self.validate(requestName)
requestNames.append(key[8:])
for requestName in requestNames:
if kwargs['action'] == 'Reject':
ChangeState.changeRequestStatus(requestName, 'rejected')
else:
assignments = GetRequest.getAssignmentsByName(requestName)
if teams == [] and assignments == []:
raise cherrypy.HTTPError(400, "Must assign to one or more teams")
self.assignWorkload(requestName, kwargs)
for team in teams:
if not team in assignments:
ChangeState.assignRequest(requestName, team)
priority = kwargs.get(requestName+':priority', '')
if priority != '':
Utilities.changePriority(requestName, priority)
participle=kwargs['action']+'ed'
if self.hold and kwargs['action'] == 'Assign':
participle='put into hold state (see <a href="%s">clipboard</a>)' % self.clipboardUrl
requests = [GetRequest.getRequestByName(requestName) for requestName in requestNames]
Clipboard.inject(self.couchUrl, self.clipboardDB, *requests)
for request in requestNames:
ChangeState.changeRequestStatus(requestName, 'ops-hold')
return self.templatepage("Acknowledge", participle=participle, requests=requestNames)