本文整理汇总了Python中Ganga.Lib.LCG.Grid.arc_purgeMultiple方法的典型用法代码示例。如果您正苦于以下问题:Python Grid.arc_purgeMultiple方法的具体用法?Python Grid.arc_purgeMultiple怎么用?Python Grid.arc_purgeMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ganga.Lib.LCG.Grid
的用法示例。
在下文中一共展示了Grid.arc_purgeMultiple方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateMonitoringInformation
# 需要导入模块: from Ganga.Lib.LCG import Grid [as 别名]
# 或者: from Ganga.Lib.LCG.Grid import arc_purgeMultiple [as 别名]
def updateMonitoringInformation(jobs):
'''Monitoring loop for normal jobs'''
import datetime
backenddict = {}
jobdict = {}
for j in jobs:
if j.backend.id and ((datetime.datetime.utcnow() - j.time.timestamps["submitted"]).seconds > config["ArcWaitTimeBeforeStartingMonitoring"]):
jobdict[j.backend.id] = j
backenddict[j.backend.actualCE] = j
if len(jobdict.keys()) == 0:
return
jobInfoDict = Grid.arc_status(
jobdict.keys(), backenddict.keys())
jidListForPurge = []
# update job information for those available in jobInfoDict
for id, info in jobInfoDict.items():
if info:
job = jobdict[id]
if job.backend.actualCE != urlparse(id)[1].split(":")[0]:
job.backend.actualCE = urlparse(id)[1].split(":")[0]
if job.backend.status != info['State']:
doStatusUpdate = True
# no need to update Ganga job status if backend status is
# not changed
if info['State'] == job.backend.status:
doStatusUpdate = False
# download output sandboxes if final status is reached
elif info['State'] in ['Finished', '(FINISHED)', 'Finished (FINISHED)']:
# grab output sandbox
if Grid.arc_get_output(job.backend.id, job.getOutputWorkspace(create=True).getPath()):
(ick, app_exitcode) = Grid.__get_app_exitcode__(
job.getOutputWorkspace(create=True).getPath())
job.backend.exitcode = app_exitcode
jidListForPurge.append(job.backend.id)
else:
logger.error(
'fail to download job output: %s' % jobdict[id].getFQID('.'))
if doStatusUpdate:
job.backend.status = info['State']
if 'Exit Code' in info:
try:
job.backend.exitcode_arc = int(
info['Exit Code'])
except:
job.backend.exitcode_arc = 1
if 'Job Error' in info:
try:
job.backend.reason = info['Job Error']
except:
pass
job.backend.updateGangaJobStatus()
else:
logger.warning(
'fail to retrieve job informaton: %s' % jobdict[id].getFQID('.'))
# purging the jobs the output has been fetched locally
if jidListForPurge:
if not Grid.arc_purgeMultiple(jidListForPurge):
logger.warning("Failed to purge all ARC jobs.")