diff --git a/jobsub/jobsub.py b/jobsub/jobsub.py index 7670653085f4b1ef04329e9da36b418af05d82f1..2a595ea4173045c50da590fff8c5016e8c69cd75 100755 --- a/jobsub/jobsub.py +++ b/jobsub/jobsub.py @@ -20,6 +20,7 @@ import sys import logging import misc import time, multiprocessing +import hashlib def runCorryvreckanLocally(filename, jobtask, silent): """ Runs Corryvreckan and stores log of output """ @@ -181,7 +182,6 @@ def main(argv=None): parser.add_argument("-j", "--cores", metavar='N', type=int, default=1, help="Number of cores used for the local job submission") parser.add_argument("--zfill", metavar='N', type=int, help="Fill run number with zeros up to the defined number of digits") parser.add_argument("runs", help="The runs to be analyzed; can be a list of single runs and/or a range, e.g. 1056-1060.", nargs='*') - parser.add_argument("--short-names", action="store_true", default=False, help="Save config and log files with the run number as their abbreviated name") args = parser.parse_args(argv) # Try to import the colorer module @@ -338,20 +338,14 @@ def main(argv=None): # ---------------------------------------------------------------- # Job submission based on selected method - local/condor - run_iteration = 0 for suffix, steering_string in zip(suffixes, steering_strings): try: #submission_settings.append((args, misc.createSteeringFile(log, args, steering_string, suffix), parameters)) - if args.short_names: - suffix = f"{runnr}_{run_iteration}" - steering_filename = misc.createSteeringFile(log, args, steering_string, suffix) - else: - steering_filename = misc.createSteeringFile(log, args, steering_string, suffix) + suffix_hash = string = hashlib.shake_128(suffix.encode()).hexdigest(16) + steering_filename = misc.createSteeringFile(log, args, steering_string, suffix_hash) results.append(submitJobs(log, pool, args, steering_filename, parameters)) except Exception as e: - log.error(f"Could not create submission file with suffix {suffix} due to {e}") - run_iteration +=1 - + log.error(f"Could not create submission file with suffix {suffix_hash} due to {e}") # Return to old directory: if args.subdir: diff --git a/jobsub/misc.py b/jobsub/misc.py index 35c083e1eac1890806e88fc4faf367177d061bb4..f1c5c9b191020584ade0fd58a94049c95812ee8b 100644 --- a/jobsub/misc.py +++ b/jobsub/misc.py @@ -122,7 +122,7 @@ def createSteeringFile(log, args, steering_string, suffix): # Get "jobtask" as basename of the configuration file: jobtask = os.path.splitext(os.path.basename(args.conf_file))[0] # Write the steering file: - filename = jobtask + "_run" + suffix + filename = jobtask + "_" + suffix log.info("filename = " + filename) steering_file = open(filename+".conf", "w")