aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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