Merge pull request #157 from openqj/feat-final-audit-detail
fix(worker): 终态审计带上 error,复发卡死可定位
This commit is contained in:
2 files changed
+36
-1
No files matched your search
+11
-1
@@ -5167,12 +5167,22 @@ class Worker:
|
||||
if final_written:
|
||||
# 审计名须与终态一致:interrupted 任务记 worker_failed
|
||||
# 会把“可续跑的中断”误读成失败,误导后续排查。
|
||||
# 终态审计细节(2026-10-29 任务 A 教训):interrupted /
|
||||
# failed 时只记 task_id,事后完全无法区分是取消、
|
||||
# 配额、host 返回 interrupted 还是其它失败——且自动
|
||||
# 续跑会把 error_text 覆盖掉,第一轮的原因就此丢失。
|
||||
# 因此非完成终态的审计 detail 带上 error(截 500 字、
|
||||
# 去换行,不含 prompt/key),完成态仍只记 task_id。
|
||||
_final_detail = task_id
|
||||
if final in ("interrupted", "failed") and error:
|
||||
_final_detail = "%s: %s" % (
|
||||
task_id, str(error)[:500].replace("\n", " "))
|
||||
self._audit(task["project_id"],
|
||||
"worker_quota_stop" if quota_stop else
|
||||
("worker_completed" if final == "completed"
|
||||
else "worker_interrupted"
|
||||
if final == "interrupted"
|
||||
else "worker_failed"), task_id)
|
||||
else "worker_failed"), _final_detail)
|
||||
log_event(self.logger,
|
||||
"worker_quota_stop" if quota_stop else
|
||||
("worker_completed" if final == "completed"
|
||||
|
||||
Reference in new issue
Block a user