From 777b82bf9ec497347c21a1b4c1e5f0aa31ae1de7 Mon Sep 17 00:00:00 2001
From: lb584 <lb584@cam.ac.uk>
Date: Wed, 27 Sep 2023 15:11:17 +0100
Subject: [PATCH] adding a non-zero exit code when endScript is called
 prematurely (for airflow)

---
 coordinator/ProcessorUtils.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/coordinator/ProcessorUtils.py b/coordinator/ProcessorUtils.py
index 817d8c4..c068364 100644
--- a/coordinator/ProcessorUtils.py
+++ b/coordinator/ProcessorUtils.py
@@ -208,14 +208,14 @@ def endScript(
     if not premature:
 
         logger.info(f'Script finished!')
-
+        exit_code = 0
     else:
 
         logger.info(f'Script finished prematurely')
+        exit_code = 1
 
     logger.info(f'--------')
-
-    sys.exit()
+    sys.exit(exit_code)
 
 def endJob(status,ignore_inprogress=False,**kwargs):
 
-- 
GitLab