本文整理汇总了Python中DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer.removeSubRequest方法的典型用法代码示例。如果您正苦于以下问题:Python RequestContainer.removeSubRequest方法的具体用法?Python RequestContainer.removeSubRequest怎么用?Python RequestContainer.removeSubRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer
的用法示例。
在下文中一共展示了RequestContainer.removeSubRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UploadOutputData
# 需要导入模块: from DIRAC.RequestManagementSystem.Client.RequestContainer import RequestContainer [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.RequestContainer.RequestContainer import removeSubRequest [as 别名]
#.........这里部分代码省略.........
self.log.error('Could not transfer and register %s with metadata:\n %s' % (fileName, metadata))
failover[fileName] = metadata
else:
lfn = metadata['lfn']
else:
failover = final
self.failoverSEs = self.ops.getValue("Production/%s/FailOverSE" % self.experiment, self.failoverSEs)
cleanUp = False
for fileName, metadata in failover.items():
self.log.info('Setting default catalog for failover transfer to FileCatalog')
random.shuffle(self.failoverSEs)
targetSE = metadata['resolvedSE'][0]
metadata['resolvedSE'] = self.failoverSEs
result = failoverTransfer.transferAndRegisterFileFailover(fileName, metadata['localpath'],
metadata['lfn'], targetSE, metadata['resolvedSE'],
fileGUID = metadata['guid'], fileCatalog = catalogs)
if not result['OK']:
self.log.error('Could not transfer and register %s with metadata:\n %s' % (fileName, metadata))
cleanUp = True
break #no point continuing if one completely fails
os.remove("DISABLE_WATCHDOG_CPU_WALLCLOCK_CHECK") #cleanup the mess
#Now after all operations, retrieve potentially modified request object
result = failoverTransfer.getRequestObject()
if not result['OK']:
self.log.error(result)
return S_ERROR('Could not retrieve modified request')
self.request = result['Value']
#If some or all of the files failed to be saved to failover
if cleanUp:
lfns = []
for fileName, metadata in final.items():
lfns.append(metadata['lfn'])
result = self.__cleanUp(lfns)
self.workflow_commons['Request'] = self.request
return S_ERROR('Failed to upload output data')
# #Can now register the successfully uploaded files in the BK
# if not performBKRegistration:
# self.log.info('There are no files to perform the BK registration for, all could be saved to failover')
# else:
# rm = ReplicaManager()
# result = rm.addCatalogFile(performBKRegistration,catalogs=['BookkeepingDB'])
# self.log.verbose(result)
# if not result['OK']:
# self.log.error(result)
# return S_ERROR('Could Not Perform BK Registration')
# if result['Value']['Failed']:
# for lfn,error in result['Value']['Failed'].items():
# self.log.info('BK registration for %s failed with message: "%s" setting failover request' %(lfn,error))
# result = self.request.addSubRequest({'Attributes':{'Operation':'registerFile','ExecutionOrder':0, 'Catalogue':'BookkeepingDB'}},'register')
# if not result['OK']:
# self.log.error('Could not set registerFile request:\n%s' %result)
# return S_ERROR('Could Not Set BK Registration Request')
# fileDict = {'LFN':lfn,'Status':'Waiting'}
# index = result['Value']
# self.request.setSubRequestFiles(index,'register',[fileDict])
self.workflow_commons['Request'] = self.request
return S_OK('Output data uploaded')
#############################################################################
def __cleanUp(self, lfnList):
""" Clean up uploaded data for the LFNs in the list
"""
# Clean up the current request
for req_type in ['transfer', 'register']:
for lfn in lfnList:
result = self.request.getNumSubRequests(req_type)
if result['OK']:
nreq = result['Value']
if nreq:
# Go through subrequests in reverse order in order not to spoil the numbering
ind_range = [0]
if nreq > 1:
ind_range = range(nreq-1, -1, -1)
for i in ind_range:
result = self.request.getSubRequestFiles(i, req_type)
if result['OK']:
fileList = result['Value']
if fileList[0]['LFN'] == lfn:
result = self.request.removeSubRequest(i, req_type)
# Set removal requests just in case
for lfn in lfnList:
result = self.request.addSubRequest({'Attributes': {'Operation' : 'removeFile', 'TargetSE' : '',
'ExecutionOrder' : 1}}, 'removal')
index = result['Value']
fileDict = {'LFN':lfn, 'PFN':'', 'Status':'Waiting'}
self.request.setSubRequestFiles(index, 'removal', [fileDict])
return S_OK()
#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#