本文整理汇总了Python中DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient.exists方法的典型用法代码示例。如果您正苦于以下问题:Python FileCatalogClient.exists方法的具体用法?Python FileCatalogClient.exists怎么用?Python FileCatalogClient.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient
的用法示例。
在下文中一共展示了FileCatalogClient.exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DataRecoveryAgent
# 需要导入模块: from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient [as 别名]
# 或者: from DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient import exists [as 别名]
#.........这里部分代码省略.........
self.log.notice( job )
self.notesToSend += do['Message']+'\n'
self.notesToSend += str(job)+'\n'
do['Actions'](job, tInfo)
return
def getLFNStatus(self, jobs):
"""Get all the LFNs for the jobs and get their status."""
self.log.notice('Collecting LFNs...')
lfnExistence = {}
lfnCache = []
for counter, job in enumerate(jobs.values()):
if counter % self.printEveryNJobs == 0:
self.log.notice('Getting JobInfo: %d/%d: %3.1fs' % (counter, len(jobs), float(time.time() - self.startTime)))
while True:
try:
job.getJobInformation(self.diracILC)
if job.inputFile:
lfnCache.append(job.inputFile)
if job.outputFiles:
lfnCache.extend(job.outputFiles)
break
except RuntimeError as e: # try again
self.log.error('+++++ Failure for job:', job.jobID)
self.log.error('+++++ Exception: ', str(e))
counter = 0
for lfnChunk in breakListIntoChunks(list(lfnCache), 200):
counter += 200
if counter % 1000 == 0:
self.log.notice('Getting FileInfo: %d/%d: %3.1fs' % (counter, len(jobs), float(time.time() - self.startTime)))
while True:
try:
reps = self.fcClient.exists(lfnChunk)
if not reps['OK']:
self.log.error('Failed to check file existence, try again...', reps['Message'])
raise RuntimeError('Try again')
statuses = reps['Value']
lfnExistence.update(statuses['Successful'])
break
except RuntimeError: # try again
pass
return lfnExistence
def setPendingRequests(self, jobs):
"""Loop over all the jobs and get requests, if any."""
for jobChunk in breakListIntoChunks(jobs.values(), 1000):
jobIDs = [job.jobID for job in jobChunk]
while True:
result = self.reqClient.readRequestsForJobs(jobIDs)
if result['OK']:
break
self.log.error('Failed to read requests', result['Message'])
# repeat
for jobID in result['Value']['Successful']:
request = result['Value']['Successful'][jobID]
requestID = request.RequestID
dbStatus = self.reqClient.getRequestStatus(requestID).get('Value', 'Unknown')
for job in jobChunk:
if job.jobID == jobID:
job.pendingRequest = dbStatus not in ('Done', 'Canceled')
self.log.notice('Found %s request for job %d' % ('pending' if job.pendingRequest else 'finished', jobID))
break
def checkAllJobs(self, jobs, tInfo, tasksDict=None, lfnTaskDict=None):