diff --git a/maap_utils/JobManager.py b/maap_utils/JobManager.py index 319499b4587a847d99a139ed79b0df966f3d4ea0..ed8261637be9ce251dc0d5d82d45553909c87886 100644 --- a/maap_utils/JobManager.py +++ b/maap_utils/JobManager.py @@ -6,6 +6,7 @@ from tqdm import tqdm from pathlib import Path import logging import json +import sys from .RunConfig import RunConfig from .Job import Job @@ -70,8 +71,13 @@ class JobManager: # Wait 10 seconds after submitting jobs, with tqdm bar tqdm.write("Waiting for jobs to start") - for i in tqdm(range(10), desc=""): - time.sleep(1) + try: + for i in tqdm(range(10), desc=""): + time.sleep(1) + except KeyboardInterrupt: + logging.info("Submission interrupted by user") + self.exit_gracefully() + sys.exit(1) def _update_states(self, batch_size: int = 50, delay: int = 10): """Internal method to update job states in batches"""