diff --git a/jobsub/jobsub.py b/jobsub/jobsub.py index 6facde1ae2d3a69f2c8cc9ccb613e1cba35e002e..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 """ @@ -340,15 +341,16 @@ def main(argv=None): for suffix, steering_string in zip(suffixes, steering_strings): try: #submission_settings.append((args, misc.createSteeringFile(log, args, steering_string, suffix), parameters)) - 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: - log.warning(f"Could not create submission file {steering_string} with suffix {suffix}") + except Exception as e: + log.error(f"Could not create submission file with suffix {suffix_hash} due to {e}") # Return to old directory: if args.subdir: os.chdir(base_path) - + misc.poolChecker(results) signal.signal(signal.SIGINT, prevINTHandler) diff --git a/jobsub/misc.py b/jobsub/misc.py index 2187015015a59ef8fef49b8acf4a046bd25efdfe..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") @@ -163,7 +163,9 @@ def poolChecker(results, heartbeat = 1): """ checks the status of parallel pool """ import time log = logging.getLogger('jobsub') - if None not in results: + if results == []: + log.warning("There were problems with the submission") + elif None not in results: # parallel loop checker from https://stackoverflow.com/a/70666333 while True: log.debug("Heartbeat") @@ -186,3 +188,4 @@ def poolChecker(results, heartbeat = 1): # raise exception reporting exceptions received from workers if all(ready) and not all(successful): raise Exception(f'Workers raised following exceptions {[result._value for result in results if not result.successful()]}') + \ No newline at end of file