本文整理汇总了Python中DIRAC.RequestManagementSystem.Client.RequestClient.RequestClient.setRequestStatus方法的典型用法代码示例。如果您正苦于以下问题:Python RequestClient.setRequestStatus方法的具体用法?Python RequestClient.setRequestStatus怎么用?Python RequestClient.setRequestStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.RequestManagementSystem.Client.RequestClient.RequestClient
的用法示例。
在下文中一共展示了RequestClient.setRequestStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RequestCleaningAgent
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.RequestClient import RequestClient [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.RequestClient.RequestClient import setRequestStatus [as 别名]
class RequestCleaningAgent(AgentModule):
def initialize(self):
self.graceRemovalPeriod = self.am_getOption('GraceRemovalPeriod',7)
self.checkAssigned = self.am_getOption('CheckAssigned',True)
self.assignedResetDelay = self.am_getOption('AssignedResetDelay',7200)
self.ftsCleaning = self.am_getOption('FTSCleaning',True)
self.requestClient = RequestClient()
return S_OK()
def execute(self):
""" Main execution method
"""
toDate = dateTime() - day*self.graceRemovalPeriod
result = self.requestClient.selectRequests({'Status':'Done','ToDate':str(toDate)})
if not result['OK']:
return result
requestDict = result['Value']
for rID,rName in requestDict.items():
gLogger.verbose("Removing request %s" % rName)
result = self.requestClient.deleteRequest(rName)
if not result['OK']:
gLogger.error('Failed to delete request %s' % rName, result['Message'])
else:
gLogger.info('Successfully removed request %d/%s' % (rID,rName) )
if self.checkAssigned:
toDate = dateTime() - second*self.assignedResetDelay
result = self.requestClient.selectRequests({'Status':'Assigned','ToDate':str(toDate)})
if not result['OK']:
return result
requestDict = result['Value']
for rID,rName in requestDict.items():
gLogger.verbose("Resetting request %s to Waiting" % rName)
result = self.requestClient.setRequestStatus(rName,'Waiting')
if not result['OK']:
gLogger.error('Failed to reset request %s to Waiting' % rName, result['Message'])
else:
gLogger.info('Successfully reset request %d/%s to Waiting' % (rID,rName) )
if self.ftsCleaning:
pass
return S_OK()