Commit 5db69d63 by ‘chizw’

[+]异常日志优化

1 parent f4bb99cf
...@@ -109,7 +109,7 @@ def deal_worker(task_id: str): ...@@ -109,7 +109,7 @@ def deal_worker(task_id: str):
) )
log.info(f"Worker {task_id} finished.") log.info(f"Worker {task_id} finished.")
except Exception as e: except Exception as e:
funasr_db.update_ali_asr_model_res_fail(task_id, traceback.format_exc()) funasr_db.update_ali_asr_model_res_fail(task_id, str(e), traceback.format_exc())
log.error(f"Worker error{e}") log.error(f"Worker error{e}")
traceback.print_exc() traceback.print_exc()
return {"Worker error": str(e)} return {"Worker error": str(e)}
......
...@@ -33,11 +33,12 @@ def update_ali_asr_model_res(task_id: str, json_output: str, execute_time: int): ...@@ -33,11 +33,12 @@ def update_ali_asr_model_res(task_id: str, json_output: str, execute_time: int):
return pool.update_one(update_sql, (json_output, execute_time, task_id,)) return pool.update_one(update_sql, (json_output, execute_time, task_id,))
def update_ali_asr_model_res_fail(task_id: str, exception: str): def update_ali_asr_model_res_fail(task_id: str, exception_msg: str, exception: str):
update_sql = ( update_sql = (
f"update ali_asr_model_res t set t.task_status = 2, t.exception_log = %s,exception_limit = exception_limit + 1 " f"update ali_asr_model_res t set t.task_status = 2, t.exception_msg = %s, t.exception_log = %s, "
f"exception_limit = exception_limit + 1 "
f"where t.task_id = %s;") f"where t.task_id = %s;")
return pool.update_one(update_sql, (exception, task_id,)) return pool.update_one(update_sql, (exception_msg, exception, task_id,))
def select_ali_asr_model_res(task_id: str): def select_ali_asr_model_res(task_id: str):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!