From c205c9d2e35029acdc4bcb7467974a452520fc4d Mon Sep 17 00:00:00 2001 From: Alex Wiens <alex.wiens@uni-paderborn.de> Date: Mon, 17 Feb 2025 17:59:50 +0100 Subject: [PATCH] Prule.daemon: Add exception traceback printing --- prule/daemon/__main__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/prule/daemon/__main__.py b/prule/daemon/__main__.py index 6c839fd..fce3281 100644 --- a/prule/daemon/__main__.py +++ b/prule/daemon/__main__.py @@ -185,6 +185,7 @@ class JobQueue: with open(path, "r") as f: data = json.load(f) except Exception as e: + traceback.print_exc() print(e) return False self.smallest_starttime = data["smallest_starttime"] @@ -209,6 +210,7 @@ class JobQueue: json.dump(data, f) print("Saved state to {}.".format(path)) except Exception as e: + traceback.print_exc() print(e) print("Failed to save the state to {}:".format(path)) print(data) @@ -360,14 +362,15 @@ class CCCheckThread(threading.Thread): signal.pthread_kill(config.main_tid, signal.SIGTERM) # shutdown return None except Exception as e: + traceback.print_exc() print(e) #traceback.print_exc() return None with self.stopCondition: self.requestFuture = self.executor.submit(execRequest, req) except Exception as e: - print(e) traceback.print_exc() + print(e) return None #await self.requestTask @@ -537,6 +540,7 @@ class PruleThread(threading.Thread): return "wait" return None except Exception as e: # something went horribly wrong + traceback.print_exc() print("request_job_meta",e) return None return None @@ -571,6 +575,7 @@ class PruleThread(threading.Thread): return True return False except Exception as e: # something went horribly wrong + traceback.print_exc() print(e) return False return False @@ -606,6 +611,7 @@ class PruleThread(threading.Thread): return "wait" return False except Exception as e: # something went horribly wrong + traceback.print_exc() print(e) tdir.cleanup() return False @@ -633,6 +639,7 @@ class PruleThread(threading.Thread): signal.pthread_kill(config.main_tid, signal.SIGTERM) # shutdown return False except Exception as e: # something went horribly wrong + traceback.print_exc() print(e) return False return False @@ -666,6 +673,7 @@ class PruleThread(threading.Thread): result = json.loads(line) break except Exception as e: + traceback.print_exc() print(e) if self.stopThread == True: return (None, 0.0) @@ -792,6 +800,7 @@ class PruleThread(threading.Thread): result_json["evaluation_time"] )) except Exception as e: + traceback.print_exc() print(e) print("Job {} process result {}".format(job.ccjobid, result_json)) @@ -831,6 +840,7 @@ class PruleThread(threading.Thread): with prule.debug.Timing("prulethread.db_insert_result", "PRINT_TIMING" in config.config): self.db_con.db_insert_result(job.ccjobid, result_json, job_meta, process_time, evaluated) except Exception as e: + traceback.print_exc() print(e) print("ERROR: db_insert_result failed for job ccid {}".format(job.ccjobid)) process_result = "failure-shutdown" @@ -924,6 +934,7 @@ class PruleThread(threading.Thread): with prule.debug.Timing("prulethread.db_insert_failure", "PRINT_TIMING" in config.config): self.db_con.db_insert_failure(job.ccjobid) except Exception as e: + traceback.print_exc() print(e) print("ERROR: db_insert_failure failed for job ccid {}, requeue".format(job.ccjobid)) queue.add(job) -- GitLab