本文整理汇总了Python中WMCore.Services.ReqMgr.ReqMgr.ReqMgr.getRequestByStatus方法的典型用法代码示例。如果您正苦于以下问题:Python ReqMgr.getRequestByStatus方法的具体用法?Python ReqMgr.getRequestByStatus怎么用?Python ReqMgr.getRequestByStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Services.ReqMgr.ReqMgr.ReqMgr
的用法示例。
在下文中一共展示了ReqMgr.getRequestByStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ReqMgrService
# 需要导入模块: from WMCore.Services.ReqMgr.ReqMgr import ReqMgr [as 别名]
# 或者: from WMCore.Services.ReqMgr.ReqMgr.ReqMgr import getRequestByStatus [as 别名]
#.........这里部分代码省略.........
@expose
def add_group(self, **kwds):
"""add_group action"""
rows = self.admin_group.get()
print "\n### GROUPS", [r for r in rows]
rid = genid(kwds)
status = "ok" # chagne to whatever it would be
content = self.templatepage('confirm', ticket=rid, user=self.user(), status=status)
return self.abs_page('admin', content)
@expose
def add_team(self, **kwds):
"""add_team action"""
rows = self.admin_team.get()
print "\n### TEAMS", kwds, [r for r in rows]
print "request to add", kwds
rid = genid(kwds)
status = "ok" # chagne to whatever it would be
content = self.templatepage('confirm', ticket=rid, user=self.user(), status=status)
return self.abs_page('admin', content)
### Request actions ###
@expose
@checkargs(['status', 'sort'])
def assign(self, **kwds):
"""assign page"""
if not kwds:
kwds = {}
if 'status' not in kwds:
kwds.update({'status': 'assignment-approved'})
docs = []
attrs = ['RequestName', 'RequestDate', 'Group', 'Requestor', 'RequestStatus']
data = self.reqmgr.getRequestByStatus(statusList=[kwds['status']])
for key, val in data.items():
docs.append(request_attr(val, attrs))
sortby = kwds.get('sort', 'status')
docs = [r for r in sort(docs, sortby)]
misc_json = {'CMSSW Releases':releases(),
'CMSSW architectures':architectures(),
'SubscriptionPriority':['Low', 'Normal', 'High'],
'CustodialSubType':['Move', 'Replica'],
'NonCustodialSubType':['Move', 'Replica'],
'MinMergeSize':2147483648,
'MaxMergeSize':4294967296,
'MaxMergeEvents':50000,
'MaxRSS':20411724,
'MaxVSize':20411724,
'SoftTimeout':129600,
'GracePeriod':300,
'BlockCloseMaxWaitTime':66400,
'BlockCloseMaxFiles':500,
'BlockCloseMaxEvents':250000000,
'BlockCloseMaxSize':5000000000000,
'AcquisitionEra':'',
'ProcessingVersion':1,
'ProcessingString':'',
'MergedLFNBase':lfn_bases(),
'UnmergedLFNBase':lfn_unmerged_bases(),}
filter_sort = self.templatepage('filter_sort')
content = self.templatepage('assign', sort=sortby,
filter_sort_table=filter_sort,
sites=sites(),
site_white_list=site_white_list(),
site_black_list=site_black_list(),
user=self.user(), user_dn=self.user_dn(), requests=docs,
示例2: ReqMgrTest
# 需要导入模块: from WMCore.Services.ReqMgr.ReqMgr import ReqMgr [as 别名]
# 或者: from WMCore.Services.ReqMgr.ReqMgr.ReqMgr import getRequestByStatus [as 别名]
class ReqMgrTest(RESTBaseUnitTestWithDBBackend):
"""
Test WorkQueue Service client
It will start WorkQueue RESTService
Server DB sets from environment variable.
Client DB sets from environment variable.
This checks whether DS call makes without error and return the results.
Not the correctness of functions. That will be tested in different module.
"""
def setFakeDN(self):
# put into ReqMgr auxiliary database under "software" document scram/cmsms
# which we'll need a little for request injection
#Warning: this assumes the same structure in jenkins wmcore_root/test
self.admin_header = getAuthHeader(self.test_authz_key.data, ADMIN_PERMISSION)
self.create_header = getAuthHeader(self.test_authz_key.data, CREATE_PERMISSION)
self.default_header = getAuthHeader(self.test_authz_key.data, DEFAULT_PERMISSION)
self.assign_header = getAuthHeader(self.test_authz_key.data, ASSIGN_PERMISSION)
self.default_status_header = getAuthHeader(self.test_authz_key.data, DEFAULT_STATUS_PERMISSION)
def setUp(self):
self.setConfig(config)
self.setCouchDBs([(config.views.data.couch_reqmgr_db, "ReqMgr"),
(config.views.data.couch_reqmgr_aux_db, None)])
self.setSchemaModules([])
RESTBaseUnitTestWithDBBackend.setUp(self)
self.setFakeDN()
requestPath = os.path.join(getWMBASE(), "test", "data", "ReqMgr", "requests", "DMWM")
rerecoFile = open(os.path.join(requestPath, "ReReco.json"), 'r')
rerecoArgs = JsonWrapper.load(rerecoFile)
self.rerecoCreateArgs = rerecoArgs["createRequest"]
self.rerecoAssignArgs = rerecoArgs["assignRequest"]
cmsswDoc = {"_id": "software"}
cmsswDoc[self.rerecoCreateArgs["ScramArch"]] = []
cmsswDoc[self.rerecoCreateArgs["ScramArch"]].append(self.rerecoCreateArgs["CMSSWVersion"])
insertDataToCouch(os.getenv("COUCHURL"), config.views.data.couch_reqmgr_aux_db, cmsswDoc)
self.reqSvc = ReqMgr(self.jsonSender["host"])
self.reqSvc._noStale = True
self.reqSvc['requests'].additionalHeaders = self.create_header
def tearDown(self):
RESTBaseUnitTestWithDBBackend.tearDown(self)
def testRequestSimpleCycle(self):
"""
test request cycle with one request without composite get condition.
post, get, put
"""
# test post method
response = self.reqSvc.insertRequests(self.rerecoCreateArgs)
self.assertEqual(len(response), 1)
requestName = response[0]['request']
## test get method
# get by name
response = self.reqSvc.getRequestByNames(requestName)
self.assertEqual(response[requestName]['RequestPriority'], 10000)
self.assertEqual(len(response), 1)
# get by status
response = self.reqSvc.getRequestByStatus('new')
self.assertEqual(len(response), 1)
print(response)
self.reqSvc.updateRequestStatus(requestName, 'assignment-approved')
response = self.reqSvc.getRequestByStatus('assignment-approved')
self.assertEqual(len(response), 1)
self.reqSvc.updateRequestProperty(requestName, {'RequestStatus': 'assigned',
"AcquisitionEra": "TEST_ERA",
"Team": "unittest",
"SiteWhitelist": ["T1_US_CBS"],
"SiteBlacklist": ["T1_US_FOX"]})
response = self.reqSvc.getRequestByStatus('assignment-approved')
self.assertEqual(len(response), 0)
response = self.reqSvc.getRequestByStatus('assigned')
self.assertEqual(len(response), 1)
self.assertEqual(response.values()[0]["SiteWhitelist"], ["T1_US_CBS"])
self.reqSvc.updateRequestStats(requestName, {'total_jobs': 100, 'input_lumis': 100,
'input_events': 100, 'input_num_files': 100})
示例3: ReqMgrService
# 需要导入模块: from WMCore.Services.ReqMgr.ReqMgr import ReqMgr [as 别名]
# 或者: from WMCore.Services.ReqMgr.ReqMgr.ReqMgr import getRequestByStatus [as 别名]
#.........这里部分代码省略.........
"""
Provide page wrapped with top/bottom templates.
"""
return self.templatepage('main', content=content)
def error(self, content):
"Generate common error page"
content = self.templatepage('error', content=content)
return self.abs_page('error', content)
@expose
def index(self):
"""Main page"""
content = self.templatepage('index', requests=ACTIVE_STATUS, rdict=REQUEST_STATE_TRANSITION)
return self.abs_page('main', content)
@expose
def home(self, **kwds):
"""Main page"""
return self.index(**kwds)
### Request actions ###
@expose
@checkargs(['status', 'sort'])
def assign(self, **kwds):
"""assign page"""
if not kwds:
kwds = {}
if 'status' not in kwds:
kwds.update({'status': 'assignment-approved'})
docs = []
attrs = ['RequestName', 'RequestDate', 'Group', 'Requestor', 'RequestStatus']
dataResult = self.reqmgr.getRequestByStatus(statusList=[kwds['status']])
for data in dataResult:
for val in data.values():
docs.append(request_attr(val, attrs))
sortby = kwds.get('sort', 'status')
docs = [r for r in sort(docs, sortby)]
assignDict = deepcopy(self.assignArgs)
assignDict.update(getPropValueMap())
assignDict['Team'] = self.getTeams()
filter_sort = self.templatepage('filter_sort')
content = self.templatepage('assign', sort=sortby,
filter_sort_table=filter_sort,
sites=SITE_CACHE.getData(),
site_white_list=site_white_list(),
site_black_list=site_black_list(),
user=user(), user_dn=user_dn(), requests=toString(docs),
misc_table=json2table(assignDict, web_ui_names(), "all_attributes"),
misc_json=json2form(assignDict, indent=2, keep_first_value=True))
return self.abs_page('assign', content)
@expose
@checkargs(['status', 'sort'])
def approve(self, **kwds):
"""
Approve page: get list of request associated with user DN.
Fetch their status list from ReqMgr and display if requests
were seen by data-ops.
"""
if not kwds:
kwds = {}
if 'status' not in kwds:
kwds.update({'status': 'new'})
kwds.update({'_nostale': True})