本文整理汇总了Python中WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter.getRequestByNames方法的典型用法代码示例。如果您正苦于以下问题:Python RequestDBWriter.getRequestByNames方法的具体用法?Python RequestDBWriter.getRequestByNames怎么用?Python RequestDBWriter.getRequestByNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter
的用法示例。
在下文中一共展示了RequestDBWriter.getRequestByNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Request
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import getRequestByNames [as 别名]
#.........这里部分代码省略.........
# #validate clone case
# if param.args[0] == "clone":
# param.args.pop()
# return None, request_args
if method == 'POST':
args_length = len(param.args)
if args_length == 1 and param.args[0] == "multi_update":
# special case for multi update from browser.
param.args.pop()
self._validateMultiRequests(param, safe, validate_request_update_args)
elif args_length == 1 and param.args[0] == "bynames":
# special case for multi update from browser.
param.args.pop()
self._getRequestNamesFromBody(param, safe, validate_request_update_args)
else:
self._validateRequestBase(param, safe, validate_request_create_args)
except InvalidSpecParameterValue as ex:
raise ex
except Exception as ex:
# TODO add proper error message instead of trace back
msg = traceback.format_exc()
cherrypy.log("Error: %s" % msg)
if hasattr(ex, "message"):
if hasattr(ex.message, '__call__'):
msg = ex.message()
else:
msg = str(ex)
else:
msg = str(ex)
raise InvalidSpecParameterValue(msg)
def initialize_clone(self, request_name):
requests = self.reqmgr_db_service.getRequestByNames(request_name)
clone_args = requests.values()[0]
# overwrite the name and time stamp.
initialize_request_args(clone_args, self.config, clone=True)
# timestamp status update
spec = loadSpecByType(clone_args["RequestType"])
workload = spec.factoryWorkloadConstruction(clone_args["RequestName"],
clone_args)
return (workload, clone_args)
def _maskTaskStepChain(self, masked_dict, req_dict, chain_name, mask_key):
mask_exist = False
num_loop = req_dict["%sChain" % chain_name]
for i in range(num_loop):
if mask_key in req_dict["%s%s" % (chain_name, i+1)]:
mask_exist = True
break
if mask_exist:
defaultValue = masked_dict[mask_key]
masked_dict[mask_key] = []
# assume mask_key is list if the condition doesn't meet.
for i in range(num_loop):
chain = req_dict["%s%s" % (chain_name, i+1)]
if mask_key in chain:
chain_key = "%sName" % chain_name
masked_dict[mask_key].append({chain_key: chain[chain_key], mask_key: chain[mask_key]})
else:
if isinstance(defaultValue, dict):
value = defaultValue.get(chain_key, None)
else:
示例2: Request
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import getRequestByNames [as 别名]
#.........这里部分代码省略.........
# #validate clone case
# if param.args[0] == "clone":
# param.args.pop()
# return None, request_args
if method == 'POST':
args_length = len(param.args)
if args_length == 1 and param.args[0] == "multi_update":
# special case for multi update from browser.
param.args.pop()
self._validateMultiRequests(param, safe, validate_request_update_args)
elif args_length == 1 and param.args[0] == "bynames":
# special case for multi update from browser.
param.args.pop()
self._getRequestNamesFromBody(param, safe, validate_request_update_args)
else:
self._validateRequestBase(param, safe, validate_request_create_args)
except InvalidSpecParameterValue as ex:
raise ex
except Exception as ex:
# TODO add proper error message instead of trace back
msg = traceback.format_exc()
cherrypy.log("Error: %s" % msg)
if hasattr(ex, "message"):
if hasattr(ex.message, '__call__'):
msg = ex.message()
else:
msg = str(ex)
else:
msg = str(ex)
raise InvalidSpecParameterValue(msg)
def initialize_clone(self, request_name):
requests = self.reqmgr_db_service.getRequestByNames(request_name)
clone_args = requests.values()[0]
# overwrite the name and time stamp.
initialize_request_args(clone_args, self.config, clone=True)
# timestamp status update
spec = loadSpecByType(clone_args["RequestType"])
workload = spec.factoryWorkloadConstruction(clone_args["RequestName"],
clone_args)
return (workload, clone_args)
@restcall(formats=[('application/json', JSONFormat())])
def get(self, **kwargs):
"""
Returns request info depending on the conditions set by kwargs
Currently defined kwargs are following.
statusList, requestNames, requestType, prepID, inputDataset, outputDataset, dateRange
If jobInfo is True, returns jobInfomation about the request as well.
TODO:
stuff like this has to filtered out from result of this call:
_attachments: {u'spec': {u'stub': True, u'length': 51712, u'revpos': 2, u'content_type': u'application/json'}}
_id: maxa_RequestString-OVERRIDE-ME_130621_174227_9225
_rev: 4-c6ceb2737793aaeac3f1cdf591593da4
"""
if len(kwargs) == 0:
kwargs['status'] = "running"
options = {"descending": True, 'include_docs': True, 'limit': 200}
request_docs = self.reqmgr_db.loadView("ReqMgr", "bystatus", options)
return rows([request_docs])
# list of status