From a12e8418d28530a17ed129112d7ac55772842b6e Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas@kluyver.me.uk>
Date: Fri, 26 Feb 2021 17:09:54 +0000
Subject: [PATCH] Log when jobs finish

---
 webservice/webservice.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/webservice/webservice.py b/webservice/webservice.py
index 45b71c7f3..4b31218f4 100644
--- a/webservice/webservice.py
+++ b/webservice/webservice.py
@@ -377,6 +377,11 @@ async def update_job_db(config):
                 flgs, statii = combined[rid, action]
                 # sort by least done status
                 flg = max(flgs, key=lambda i: flg_order[i])
+                if flg != 'R':
+                    logging.info(
+                        "Jobs finished - action: %s, run id: %s, status: %s",
+                        action, rid, flg,
+                    )
                 msg = "\n".join(statii)
                 msg_debug = f"Update MDC {rid}, {msg}"
                 logging.debug(msg_debug.replace('\n', ', '))
@@ -392,9 +397,8 @@ async def update_job_db(config):
                     logging.error("Failed to update MDC for action %s, rid %s",
                                   action, rid)
                     logging.error(Errors.MDC_RESPONSE.format(response))
-        except Exception as e:
-            e = str(e)
-            logging.error(f"Failure to update job DB: {e}")
+        except Exception:
+            logging.error(f"Failure to update job DB", exc_info=True)
 
         await asyncio.sleep(time_interval)
 
-- 
GitLab