From a2b38b0b3ecafc83858b71c2f39a56590696a988 Mon Sep 17 00:00:00 2001 From: tmaeno Date: Wed, 29 Mar 2023 13:35:55 +0200 Subject: [PATCH] cleanup --- ChangeLog.txt | 3 +++ pandaclient/PandaToolsPkgInfo.py | 2 +- pandaclient/PathenaScript.py | 13 +++++++++---- pandaclient/PrunScript.py | 18 ++++++++++++------ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 10d73cfb..6336d076 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,8 @@ ** Release Notes +1.5.42 + * added retry when checking sandbox files created by cpack + 1.5.41 * added secret-related methods to JobSpec diff --git a/pandaclient/PandaToolsPkgInfo.py b/pandaclient/PandaToolsPkgInfo.py index 3d53dd5e..2410781f 100644 --- a/pandaclient/PandaToolsPkgInfo.py +++ b/pandaclient/PandaToolsPkgInfo.py @@ -1 +1 @@ -release_version = "1.5.41" +release_version = "1.5.42" diff --git a/pandaclient/PathenaScript.py b/pandaclient/PathenaScript.py index 91dab3e8..6f424267 100644 --- a/pandaclient/PathenaScript.py +++ b/pandaclient/PathenaScript.py @@ -9,6 +9,7 @@ import random import pickle import json +import time from pandaclient.MiscUtils import parse_secondary_datasets_opt try: @@ -1355,10 +1356,14 @@ def _onExit(dir, files, del_command): sys.exit(EC_Archive) # check symlinks - tmpLog.info("checking symbolic links") - status,out = commands_get_status_output('tar tvfz %s' % archiveName) + tmpLog.info("checking sandbox") + for _ in range(5): + status, out = commands_get_status_output('tar tvfz %s' % archiveName) + if status == 0: + break + time.sleep(5) if status != 0: - tmpLog.error("Failed to expand archive") + tmpLog.error("Failed to expand sandbox. {0}".format(out)) sys.exit(EC_Archive) symlinks = [] for line in out.split('\n'): @@ -1391,7 +1396,7 @@ def _onExit(dir, files, del_command): # put sources/jobO via HTTP POST if not options.noSubmit: - tmpLog.info("uploading source/jobO files") + tmpLog.info("uploading sandbox") status,out = Client.putFile(archiveName,options.verbose,useCacheSrv=True,reuseSandbox=True) if out.startswith('NewFileName:'): # found the same input sandbox to reuse diff --git a/pandaclient/PrunScript.py b/pandaclient/PrunScript.py index 3b214436..6b25f17a 100644 --- a/pandaclient/PrunScript.py +++ b/pandaclient/PrunScript.py @@ -4,6 +4,8 @@ import shutil import atexit import argparse +import time + from pandaclient.Group_argparse import GroupArgParser try: from urllib import quote @@ -981,7 +983,7 @@ def _onExit(dir, files, del_command): if options.useRootCore: # check $ROOTCOREDIR if 'ROOTCOREDIR' not in os.environ: - tmpErrMsg = '$ROOTCOREDIR is not definied in your enviornment. ' + tmpErrMsg = '$ROOTCOREDIR is not defined in your environment. ' tmpErrMsg += 'Please setup RootCore runtime beforehand' tmpLog.error(tmpErrMsg) sys.exit(EC_Config) @@ -1204,10 +1206,14 @@ def _onExit(dir, files, del_command): # check symlinks if options.useAthenaPackages: - tmpLog.info("checking symbolic links") - status,out = commands_get_status_output('tar tvfz %s' % archiveName) + tmpLog.info("checking sandbox") + for _ in range(5): + status, out = commands_get_status_output('tar tvfz %s' % archiveName) + if status == 0: + break + time.sleep(5) if status != 0: - tmpLog.error("Failed to expand archive") + tmpLog.error("Failed to expand sandbox. {0}".format(out)) sys.exit(EC_Archive) symlinks = [] for line in out.split('\n'): @@ -1241,7 +1247,7 @@ def _onExit(dir, files, del_command): # upload source files if not options.noSubmit: # upload sources via HTTP POST - tmpLog.info("upload sandbox files") + tmpLog.info("upload sandbox") if options.vo is None: use_cache_srv = True else: @@ -1252,7 +1258,7 @@ def _onExit(dir, files, del_command): archiveName = out.split(':')[-1] elif out != 'True': print(out) - tmpLog.error("failed to upload sandbox files with %s" % status) + tmpLog.error("failed to upload sandbox with %s" % status) sys.exit(EC_Post) # good run list if options.goodRunListXML != '':