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

Prule.daemon: Add exception traceback printing

parent bcfac185
No related branches found
No related tags found
No related merge requests found
...@@ -185,6 +185,7 @@ class JobQueue: ...@@ -185,6 +185,7 @@ class JobQueue:
with open(path, "r") as f: with open(path, "r") as f:
data = json.load(f) data = json.load(f)
except Exception as e: except Exception as e:
traceback.print_exc()
print(e) print(e)
return False return False
self.smallest_starttime = data["smallest_starttime"] self.smallest_starttime = data["smallest_starttime"]
...@@ -209,6 +210,7 @@ class JobQueue: ...@@ -209,6 +210,7 @@ class JobQueue:
json.dump(data, f) json.dump(data, f)
print("Saved state to {}.".format(path)) print("Saved state to {}.".format(path))
except Exception as e: except Exception as e:
traceback.print_exc()
print(e) print(e)
print("Failed to save the state to {}:".format(path)) print("Failed to save the state to {}:".format(path))
print(data) print(data)
...@@ -360,14 +362,15 @@ class CCCheckThread(threading.Thread): ...@@ -360,14 +362,15 @@ class CCCheckThread(threading.Thread):
signal.pthread_kill(config.main_tid, signal.SIGTERM) # shutdown signal.pthread_kill(config.main_tid, signal.SIGTERM) # shutdown
return None return None
except Exception as e: except Exception as e:
traceback.print_exc()
print(e) print(e)
#traceback.print_exc() #traceback.print_exc()
return None return None
with self.stopCondition: with self.stopCondition:
self.requestFuture = self.executor.submit(execRequest, req) self.requestFuture = self.executor.submit(execRequest, req)
except Exception as e: except Exception as e:
print(e)
traceback.print_exc() traceback.print_exc()
print(e)
return None return None
#await self.requestTask #await self.requestTask
...@@ -537,6 +540,7 @@ class PruleThread(threading.Thread): ...@@ -537,6 +540,7 @@ class PruleThread(threading.Thread):
return "wait" return "wait"
return None return None
except Exception as e: # something went horribly wrong except Exception as e: # something went horribly wrong
traceback.print_exc()
print("request_job_meta",e) print("request_job_meta",e)
return None return None
return None return None
...@@ -571,6 +575,7 @@ class PruleThread(threading.Thread): ...@@ -571,6 +575,7 @@ class PruleThread(threading.Thread):
return True return True
return False return False
except Exception as e: # something went horribly wrong except Exception as e: # something went horribly wrong
traceback.print_exc()
print(e) print(e)
return False return False
return False return False
...@@ -606,6 +611,7 @@ class PruleThread(threading.Thread): ...@@ -606,6 +611,7 @@ class PruleThread(threading.Thread):
return "wait" return "wait"
return False return False
except Exception as e: # something went horribly wrong except Exception as e: # something went horribly wrong
traceback.print_exc()
print(e) print(e)
tdir.cleanup() tdir.cleanup()
return False return False
...@@ -633,6 +639,7 @@ class PruleThread(threading.Thread): ...@@ -633,6 +639,7 @@ class PruleThread(threading.Thread):
signal.pthread_kill(config.main_tid, signal.SIGTERM) # shutdown signal.pthread_kill(config.main_tid, signal.SIGTERM) # shutdown
return False return False
except Exception as e: # something went horribly wrong except Exception as e: # something went horribly wrong
traceback.print_exc()
print(e) print(e)
return False return False
return False return False
...@@ -666,6 +673,7 @@ class PruleThread(threading.Thread): ...@@ -666,6 +673,7 @@ class PruleThread(threading.Thread):
result = json.loads(line) result = json.loads(line)
break break
except Exception as e: except Exception as e:
traceback.print_exc()
print(e) print(e)
if self.stopThread == True: if self.stopThread == True:
return (None, 0.0) return (None, 0.0)
...@@ -792,6 +800,7 @@ class PruleThread(threading.Thread): ...@@ -792,6 +800,7 @@ class PruleThread(threading.Thread):
result_json["evaluation_time"] result_json["evaluation_time"]
)) ))
except Exception as e: except Exception as e:
traceback.print_exc()
print(e) print(e)
print("Job {} process result {}".format(job.ccjobid, result_json)) print("Job {} process result {}".format(job.ccjobid, result_json))
...@@ -831,6 +840,7 @@ class PruleThread(threading.Thread): ...@@ -831,6 +840,7 @@ class PruleThread(threading.Thread):
with prule.debug.Timing("prulethread.db_insert_result", "PRINT_TIMING" in config.config): 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) self.db_con.db_insert_result(job.ccjobid, result_json, job_meta, process_time, evaluated)
except Exception as e: except Exception as e:
traceback.print_exc()
print(e) print(e)
print("ERROR: db_insert_result failed for job ccid {}".format(job.ccjobid)) print("ERROR: db_insert_result failed for job ccid {}".format(job.ccjobid))
process_result = "failure-shutdown" process_result = "failure-shutdown"
...@@ -924,6 +934,7 @@ class PruleThread(threading.Thread): ...@@ -924,6 +934,7 @@ class PruleThread(threading.Thread):
with prule.debug.Timing("prulethread.db_insert_failure", "PRINT_TIMING" in config.config): with prule.debug.Timing("prulethread.db_insert_failure", "PRINT_TIMING" in config.config):
self.db_con.db_insert_failure(job.ccjobid) self.db_con.db_insert_failure(job.ccjobid)
except Exception as e: except Exception as e:
traceback.print_exc()
print(e) print(e)
print("ERROR: db_insert_failure failed for job ccid {}, requeue".format(job.ccjobid)) print("ERROR: db_insert_failure failed for job ccid {}, requeue".format(job.ccjobid))
queue.add(job) queue.add(job)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment