diff --git a/prule/daemon/__main__.py b/prule/daemon/__main__.py index e7e91b49f4ca6d021ff140fa7672830a96734df7..75847ed5966a2a33cb1cd6670f34497d56d2bb8a 100644 --- a/prule/daemon/__main__.py +++ b/prule/daemon/__main__.py @@ -491,7 +491,7 @@ class CCCheckThread(threading.Thread): if smallest_starttime < sys.maxsize: queue.smallest_starttime = smallest_starttime - def run(self): + def run_main(self): self.executor = concurrent.futures.ThreadPoolExecutor(max_workers=1) while self.stopThread == False: @@ -514,6 +514,14 @@ class CCCheckThread(threading.Thread): # thread done print("CCCheckThread Done") self.executor.shutdown(wait=False) + def run(self): + try: + self.run_main() + except Exception as e: + traceback.print_exc() + print("CCCheckThread",e) + if self.config.shutdown == False: + self.config.signal_shutdown() def stop(self): with self.stopCondition: print("Stop CCCheckThread") @@ -884,7 +892,7 @@ class PruleThread(threading.Thread): job_tempdir.cleanup() return process_result - def run(self): + def run_main(self): if self.config.config["CACHE_DB"] == True: self.db_con = prule.db.ResultsDB(self.config.config["DB_PATH"]) @@ -1003,6 +1011,14 @@ class PruleThread(threading.Thread): if self.config.config["CACHE_DB"] == True: self.db_con.close() self.db_con = None + def run(self): + try: + self.run_main() + except Exception as e: + traceback.print_exc() + print("PruleThread:",e) + if self.config.shutdown == False: + self.config.signal_shutdown() def stop(self): with self.stopCondition: if self.currentProcess != None: