about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-12-03 12:35:05 -0600
committerFrederick Muriuki Muriithi2025-12-03 12:35:05 -0600
commitd461596b55086310717dc30f6816f6ae452a61bd (patch)
tree319c3e8eb0a3e592d6d0f32d48af6e3c75c724f7
parent7cf30517630a1b3ffa50b3eb4f1e9304924d964a (diff)
downloadgn-uploader-d461596b55086310717dc30f6816f6ae452a61bd.tar.gz
Fix exitcode: Ensure correct exit code is returned.
-rw-r--r--scripts/run_qtlreaper.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/run_qtlreaper.py b/scripts/run_qtlreaper.py
index 764ee70..c3aef5d 100644
--- a/scripts/run_qtlreaper.py
+++ b/scripts/run_qtlreaper.py
@@ -109,6 +109,7 @@ def save_qtl_values_to_db(conn, qtls: dict):
 
 def dispatch(args: Namespace) -> int:
     """Dispatch the actual logic."""
+    exitcode = 1
     with mysqldb.database_connection(args.db_uri) as conn:
         try:
             population = population_by_species_and_id(conn, args.species_id, args.population_id)
@@ -166,7 +167,7 @@ def dispatch(args: Namespace) -> int:
             _traitsfile.unlink()
             _qtlreaper_main_output.unlink()
             logger.info("Successfully computed p values for %s traits.", len(_traitsdata))
-            return 0
+            exitcode = 0
         except FileNotFoundError as fnf:
             logger.error(", ".join(fnf.args), exc_info=False)
         except AssertionError as aserr:
@@ -175,7 +176,7 @@ def dispatch(args: Namespace) -> int:
             logger.debug("Type of exception: %s", type(_exc))
             logger.error("General exception!", exc_info=True)
         finally:
-            return 1
+            return exitcode
 
 # python3 -m scripts.run_qtlreaper "mysql://webqtlout:webqtlout@127.0.0.1:3307/db_webqtl" 1 1 /home/frederick/genotype_files/genotype /tmp/qc_app_files/qtlreaper --loglevel debug