Skip to content
Snippets Groups Projects
Commit a7961d74 authored by Alex Wiens's avatar Alex Wiens
Browse files

Prule.daemon: Add catching of all exceptions in a thread and shutting down.

parent 97091a6f
Branches
No related tags found
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment