本文整理汇总了Python中WMCore.Services.RequestManager.RequestManager.RequestManager.getRequestNames方法的典型用法代码示例。如果您正苦于以下问题:Python RequestManager.getRequestNames方法的具体用法?Python RequestManager.getRequestNames怎么用?Python RequestManager.getRequestNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Services.RequestManager.RequestManager.RequestManager
的用法示例。
在下文中一共展示了RequestManager.getRequestNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getRequestInfoFromReqMgr
# 需要导入模块: from WMCore.Services.RequestManager.RequestManager import RequestManager [as 别名]
# 或者: from WMCore.Services.RequestManager.RequestManager.RequestManager import getRequestNames [as 别名]
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")
示例2: ReqMgrTester
# 需要导入模块: from WMCore.Services.RequestManager.RequestManager import RequestManager [as 别名]
# 或者: from WMCore.Services.RequestManager.RequestManager.RequestManager import getRequestNames [as 别名]
class ReqMgrTester(object):
def __init__(self, reqMgrUrl):
self.reqMgrUrl = reqMgrUrl
self.restSender = JSONRequests(reqMgrUrl)
d = dict(endpoint = self.reqMgrUrl)
self.reqMgrService = RequestManager(d)
def queryAllRequests(self):
"""
Returns all requests stored at ReqMgr instance.
"""
logging.info("Querying all requests at ReqMgr instance ...")
r = self.reqMgrService.getRequestNames()
print "Found %s requests:" % len(r)
for req in r:
print req
def queryRequest(self, requestName):
"""
Query a specific request according to the input argument.
"""
urlQuery = "request/%s" % requestName
logging.info("Querying request '%s'" % requestName)
logging.info("Query: '%s':" % urlQuery)
r = self.restSender.get(urlQuery)
print str(r)
def createRequests(self, numRequests):
"""
Inject new numRequests into ReqMgr instance.
(see ReqMgr_t testE how to create a request)
"""
logging.info("Creating %s new requests ..." % numRequests)
schema = ReReco.getTestArguments()
schema['RequestName'] = 'TestReReco'
schema['RequestType'] = 'ReReco'
schema['CmsPath'] = "/uscmst1/prod/sw/cms"
schema['Requestor'] = '%s' % "zmaxa"
schema['Group'] = '%s' % "DATAOPS"
schema['BlockWhitelist'] = ['/dataset/dataset/dataset#alpha']
schema['BlockBlacklist'] = ['/dataset/dataset/dataset#beta']
schema['Campaign'] = 'MyTestCampaign'
for i in range(numRequests):
urlQuery = "request/testRequest"
print "Query: '%s':" % urlQuery
print "Schema (request): '%s'" % schema
r = self.restSender.put(urlQuery, schema)
# print "request creating response: ", r
print "created: ", r[0]["RequestName"]
def deleteRequest(self, requestNames):
"""
Delete requests specified in the input, more request names
are comma-separated.
"""
logging.info("Deleting requests ...")
for reqName in requestNames.split(','):
reqName = reqName.strip()
urlQuery = "request/%s" % reqName
logging.info("Deleting request (request_name): '%s'" % reqName)
logging.info("Query: '%s':" % urlQuery)
r = self.restSender.delete(urlQuery)
def requestChangeStates(self, reqName):
"""
Route the request (spec. by the request name) in the input
through a series of possible request states.
"""
logging.info("Changing state of request %s ..." % reqName)
def changeState(requestName, urlQuery):
logging.info("Query: '%s' ..." % urlQuery)
r = self.restSender.put(urlQuery)
r = self.restSender.get("request/%s" % requestName)
#assert r[0]["RequestStatus"] == statusName
logging.info("Querying modified request, new state: %s" % r[0]["RequestStatus"])
# once a request is created, it's in 'new' state
# states transition has to be an allowed one as defined here:
# WMCore/RequestManager/RequestDB/Settings/RequestStatus.py
statesQueries = ["request/%s?status=%s" % (reqName, "testing-approved"),
"request/%s?status=%s" % (reqName, "testing"),
"request/%s?status=%s" % (reqName, "tested"),
"request/%s?status=%s" % (reqName, "assignment-approved"),
# create an assignment now
# need quote because of space in the team name
# (previous name - White Sox)
urllib.quote("assignment/%s/%s" % (TEAM_NAME, reqName))]
for query in statesQueries:
changeState(reqName, query)
#.........这里部分代码省略.........