about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-12-02 16:19:52 -0600
committerFrederick Muriuki Muriithi2024-12-02 16:19:52 -0600
commitd93511d051d3b8abc97053bd4e66a2cf3812e8d3 (patch)
treeb9b1d60b79b318c46f5d424294ee7b051cde771f /scripts
parent9914e9ed215e93bf1dea1f37d27c14150c3cad66 (diff)
downloadgn-uploader-d93511d051d3b8abc97053bd4e66a2cf3812e8d3.tar.gz
Send logs to STDOUT too.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rqtl2/entry.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/rqtl2/entry.py b/scripts/rqtl2/entry.py
index bd8f0b4..2a18aa3 100644
--- a/scripts/rqtl2/entry.py
+++ b/scripts/rqtl2/entry.py
@@ -1,7 +1,9 @@
 """Build common script-entry structure."""
+import sys
 import logging
 from typing import Callable
 from argparse import Namespace
+from logging import StreamHandler
 
 from redis import Redis
 from MySQLdb import Connection
@@ -40,6 +42,17 @@ def build_main(
                 fqjobid,
                 f"{fqjobid}:log-messages",
                 args.redisexpiry))
-            return run_fn(dbconn, args, logger)
+            logger.addHandler(StreamHandler(stream=sys.stdout))
+            try:
+                returncode = run_fn(dbconn, args, logger)
+                if returncode == 0:
+                    rconn.hset(fqjobid, "status", "completed:success")
+                    return returncode
+                rconn.hset(fqjobid, "status", "completed:error")
+                return returncode
+            except Exception as _exc:
+                logger.error("The process failed!", exc_info=True)
+                rconn.hset(fqjobid, "status", "completed:error")
+                return 4
 
     return main