Skip to content

Commit

Permalink
Set task progress on exception (#4025)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Set task progress on exception

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
yuzhichang authored Dec 13, 2024
1 parent 9363567 commit 86507af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rag/svr/task_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,19 @@ def handle_task():
with mt_lock:
DONE_TASKS += 1
CURRENT_TASK = None
logging.info(f"handle_task got TaskCanceledException for task {json.dumps(task)}")
try:
set_progress(task["id"], prog=-1, msg="handle_task got TaskCanceledException")
except Exception:
pass
logging.debug("handle_task got TaskCanceledException", exc_info=True)
except Exception:
with mt_lock:
FAILED_TASKS += 1
CURRENT_TASK = None
try:
set_progress(task["id"], prog=-1, msg="handle_task got exception, please check log")
except Exception:
pass
logging.exception(f"handle_task got exception for task {json.dumps(task)}")
if PAYLOAD:
PAYLOAD.ack()
Expand Down

0 comments on commit 86507af

Please sign in to comment.