本文整理汇总了Python中WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter.updateRequestStats方法的典型用法代码示例。如果您正苦于以下问题:Python RequestDBWriter.updateRequestStats方法的具体用法?Python RequestDBWriter.updateRequestStats怎么用?Python RequestDBWriter.updateRequestStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter
的用法示例。
在下文中一共展示了RequestDBWriter.updateRequestStats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Request
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import updateRequestStats [as 别名]
#.........这里部分代码省略.........
if not keys[request]:
keys[request] = []
keys[request].append(row["key"][1])
for request in request_info:
for agentUrl in keys[request]:
requestAgentUrlList.append([request, agentUrl])
return requestAgentUrlList
def _retrieveResubmissionChildren(self, request_name):
result = self.reqmgr_db.loadView('ReqMgr', 'childresubmissionrequests', keys=[request_name])['rows']
childrenRequestNames = []
for child in result:
childrenRequestNames.append(child['id'])
childrenRequestNames.extend(self._retrieveResubmissionChildren(child['id']))
return childrenRequestNames
def _handleNoStatusUpdate(self, workload, request_args):
"""
only few values can be updated without state transition involved
currently 'RequestPriority' and 'total_jobs', 'input_lumis', 'input_events', 'input_num_files'
"""
if 'RequestPriority' in request_args:
# must update three places: GQ elements, workload_cache and workload spec
self.gq_service.updatePriority(workload.name(), request_args['RequestPriority'])
report = self.reqmgr_db_service.updateRequestProperty(workload.name(), request_args)
workload.setPriority(request_args['RequestPriority'])
workload.saveCouchUrl(workload.specUrl())
elif "total_jobs" in request_args:
# only GQ update this stats
# request_args should contain only 4 keys 'total_jobs', 'input_lumis', 'input_events', 'input_num_files'}
report = self.reqmgr_db_service.updateRequestStats(workload.name(), request_args)
else:
raise InvalidSpecParameterValue("can't update value without state transition: %s" % request_args)
return report
def _handleAssignmentApprovedTransition(self, workload, request_args, dn):
report = self.reqmgr_db_service.updateRequestProperty(workload.name(), request_args, dn)
return report
def _handleAssignmentStateTransition(self, workload, request_args, dn):
req_status = request_args["RequestStatus"]
if req_status == "assigned" and not request_args.get('Team', '').strip():
raise InvalidSpecParameterValue("Team must be set during workflow assignment: %s" % request_args)
if ('SoftTimeout' in request_args) and ('GracePeriod' in request_args):
request_args['SoftTimeout'] = int(request_args['SoftTimeout'])
#TODO: not sure why GracePeriod when passed from web ingerface but convert here
request_args['GracePeriod'] = int(request_args['GracePeriod'])
request_args['HardTimeout'] = request_args['SoftTimeout'] + request_args['GracePeriod']
#Only allow extra value update for assigned status
cherrypy.log("INFO: Assign request, input args: %s ..." % request_args)
try:
workload.updateArguments(request_args)
except Exception as ex:
msg = traceback.format_exc()
cherrypy.log("Error for request args %s: %s" % (request_args, msg))
raise InvalidSpecParameterValue(str(ex))
# validate/update OutputDatasets after ProcessingString and AcquisionEra is updated
request_args['OutputDatasets'] = workload.listOutputDatasets()
示例2: Request
# 需要导入模块: from WMCore.Services.RequestDB.RequestDBWriter import RequestDBWriter [as 别名]
# 或者: from WMCore.Services.RequestDB.RequestDBWriter.RequestDBWriter import updateRequestStats [as 别名]
#.........这里部分代码省略.........
for request in request_info:
for agentUrl in keys[request]:
requestAgentUrlList.append([request, agentUrl])
return requestAgentUrlList
def _retrieveResubmissionChildren(self, request_name):
result = self.reqmgr_db.loadView('ReqMgr', 'childresubmissionrequests', keys=[request_name])['rows']
childrenRequestNames = []
for child in result:
childrenRequestNames.append(child['id'])
childrenRequestNames.extend(self._retrieveResubmissionChildren(child['id']))
return childrenRequestNames
def _updateRequest(self, workload, request_args):
if workload == None:
(workload, request_args) = self.initialize_clone(request_args["OriginalRequestName"])
return self.post(workload, request_args)
dn = cherrypy.request.user.get("dn", "unknown")
if ('SoftTimeout' in request_args) and ('GracePeriod' in request_args):
request_args['HardTimeout'] = request_args['SoftTimeout'] + request_args['GracePeriod']
if 'RequestPriority' in request_args:
self.gq_service.updatePriority(workload.name(), request_args['RequestPriority'])
if "total_jobs" in request_args:
# only GQ update this stats
# request_args should contain only 4 keys 'total_jobs', 'input_lumis', 'input_events', 'input_num_files'}
report = self.reqmgr_db_service.updateRequestStats(workload.name(), request_args)
# if is not just updating status
else:
req_status = request_args.get("RequestStatus", None)
if len(request_args) >= 1 and req_status == None:
try:
workload.updateArguments(request_args)
except Exception as ex:
msg = traceback.format_exc()
cherrypy.log("Error for request args %s: %s" % (request_args, msg))
raise InvalidSpecParameterValue(str(ex))
# trailing / is needed for the savecouchUrl function
workload.saveCouch(self.config.couch_host, self.config.couch_reqmgr_db)
elif (req_status in ["closed-out" "announced"]) and request_args.get("cascade", False):
cascade_list = self._retrieveResubmissionChildren(workload.name)
for req_name in cascade_list:
report = self.reqmgr_db_service.updateRequestStatus(req_name, req_status)
# If it is aborted or force-complete transition call workqueue to cancel the request
else:
if req_status == "aborted" or req_status == "force-complete":
self.gq_service.cancelWorkflow(workload.name())
report = self.reqmgr_db_service.updateRequestProperty(workload.name(), request_args, dn)
if report == 'OK':
return {workload.name(): "OK"}
else:
return {workload.name(): "ERROR"}
@restcall(formats=[('application/json', JSONFormat())])