本文整理汇总了Python中DIRAC.RequestManagementSystem.Client.ReqClient.ReqClient.cancelRequest方法的典型用法代码示例。如果您正苦于以下问题:Python ReqClient.cancelRequest方法的具体用法?Python ReqClient.cancelRequest怎么用?Python ReqClient.cancelRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.RequestManagementSystem.Client.ReqClient.ReqClient
的用法示例。
在下文中一共展示了ReqClient.cancelRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseCommandLine
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.ReqClient.ReqClient import cancelRequest [as 别名]
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
import DIRAC
requests = []
from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient
reqClient = ReqClient()
args = Script.getPositionalArgs()
if len( args ) == 1:
requests = [reqName for reqName in args[0].split( ',' ) if reqName]
if not requests:
DIRAC.gLogger.fatal( "Need at least one request name" )
Script.showHelp()
DIRAC.exit( 1 )
for reqName in requests:
reqName = reqName.strip()
res = reqClient.cancelRequest( reqName )
if res['OK']:
DIRAC.gLogger.always( "Request %s canceled" % reqName )
else:
DIRAC.gLogger.error( "Error canceling request %s" % reqName, res['Message'] )
DIRAC.exit( 0 )
示例2: in
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.ReqClient.ReqClient import cancelRequest [as 别名]
gLogger.notice("Request %s is not in requested status %s%s" %
(reqID, status, ' (cannot be reset)' if reset else ''))
continue
if fixJob and request.Status == 'Done' and request.JobID:
# The request is for a job and is Done, verify that the job is in the proper status
result = reqClient.finalizeRequest(request.RequestID, request.JobID, useCertificates=False)
if not result['OK']:
gLogger.error("Error finalizing job", result['Message'])
else:
gLogger.notice("Job %d updated to %s" % (request.JobID, result['Value']))
continue
if cancel:
if request.Status not in ('Done', 'Failed'):
ret = reqClient.cancelRequest(requestID)
if not ret['OK']:
gLogger.error("Error canceling request %s" % reqID, ret['Message'])
else:
gLogger.notice("Request %s cancelled" % reqID)
else:
gLogger.notice("Request %s is in status %s, not cancelled" % (reqID, request.Status))
elif allR or recoverableRequest(request):
okRequests.append(str(requestID))
if reset:
gLogger.notice('============ Request %s =============' % requestID)
ret = reqClient.resetFailedRequest(requestID, allR=allR)
if not ret['OK']:
gLogger.error("Error resetting request %s" % requestID, ret['Message'])
else:
示例3: TransformationCleaningAgent
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.ReqClient.ReqClient import cancelRequest [as 别名]
#.........这里部分代码省略.........
if externalIDs:
res = self.transClient.getTransformationParameters(transID, ['Type'])
if not res['OK']:
self.log.error("Failed to determine transformation type")
return res
transType = res['Value']
if transType in self.dataProcTTypes:
res = self.__removeWMSTasks(externalIDs)
else:
res = self.__removeRequests(externalIDs)
if not res['OK']:
return res
return S_OK()
def __getTransformationExternalIDs(self, transID):
""" collect all ExternalIDs for transformation :transID:
:param self: self reference
:param int transID: transforamtion ID
"""
res = self.transClient.getTransformationTasks(condDict={'TransformationID': transID})
if not res['OK']:
self.log.error("Failed to get externalIDs for transformation %d" % transID, res['Message'])
return res
externalIDs = [taskDict['ExternalID'] for taskDict in res["Value"]]
self.log.info("Found %d tasks for transformation" % len(externalIDs))
return S_OK(externalIDs)
def __removeRequests(self, requestIDs):
""" This will remove requests from the RMS system -
"""
rIDs = [int(long(j)) for j in requestIDs if long(j)]
for reqID in rIDs:
self.reqClient.cancelRequest(reqID)
return S_OK()
def __removeWMSTasks(self, transJobIDs):
""" wipe out jobs and their requests from the system
:param self: self reference
:param list trasnJobIDs: job IDs
"""
# Prevent 0 job IDs
jobIDs = [int(j) for j in transJobIDs if int(j)]
allRemove = True
for jobList in breakListIntoChunks(jobIDs, 500):
res = self.wmsClient.killJob(jobList)
if res['OK']:
self.log.info("Successfully killed %d jobs from WMS" % len(jobList))
elif ("InvalidJobIDs" in res) and ("NonauthorizedJobIDs" not in res) and ("FailedJobIDs" not in res):
self.log.info("Found %s jobs which did not exist in the WMS" % len(res['InvalidJobIDs']))
elif "NonauthorizedJobIDs" in res:
self.log.error("Failed to kill %s jobs because not authorized" % len(res['NonauthorizedJobIDs']))
allRemove = False
elif "FailedJobIDs" in res:
self.log.error("Failed to kill %s jobs" % len(res['FailedJobIDs']))
allRemove = False
res = self.wmsClient.deleteJob(jobList)
if res['OK']:
self.log.info("Successfully removed %d jobs from WMS" % len(jobList))
elif ("InvalidJobIDs" in res) and ("NonauthorizedJobIDs" not in res) and ("FailedJobIDs" not in res):
self.log.info("Found %s jobs which did not exist in the WMS" % len(res['InvalidJobIDs']))
elif "NonauthorizedJobIDs" in res:
示例4: len
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.ReqClient.ReqClient import cancelRequest [as 别名]
args = Script.getPositionalArgs()
if len( args ) == 1:
requests = [requestID for requestID in args[0].split( ',' ) if requestID]
if not requests:
DIRAC.gLogger.fatal( "Need at least one request name" )
Script.showHelp()
DIRAC.exit( 1 )
for requestID in requests:
requestID = requestID.strip()
try:
reqID = int( requestID )
except ValueError:
reqID = reqClient.getRequestIDForName( requestID )
if not reqID['OK']:
gLogger.always( reqID['Message'] )
continue
reqID = reqID['Value']
res = reqClient.cancelRequest( reqID )
if res['OK']:
DIRAC.gLogger.always( "Request %s canceled" % reqID )
else:
DIRAC.gLogger.error( "Error canceling request %s" % reqID, res['Message'] )
DIRAC.exit( 0 )