From 701ab92c5c73f489f2214b86c39ff4878fc06278 Mon Sep 17 00:00:00 2001
From: "Ian Grant (aider)" <ian.conway.grant@gmail.com>
Date: Fri, 16 May 2025 17:34:21 -0400
Subject: [PATCH] fix: handle KeyboardInterrupt in JobManager.submit()

---
 maap_utils/JobManager.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/maap_utils/JobManager.py b/maap_utils/JobManager.py
index 319499b..ed82616 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"""
-- 
GitLab