feat: cockpit v1 diagnose_project 运行中任务返回 claimed_by+心跳陈旧度
This commit is contained in:
parent
f519f48dd5
commit
13b0aa5de5
@ -426,7 +426,7 @@ async def _exec_tool(sor, tool, params, ctx, uid, org_id):
|
||||
# 3) Pending questions
|
||||
qs = await sor.sqlExe("SELECT id,question,status,task_id FROM pipeline_agent_questions WHERE tenant_id=${p}$ AND status='pending' LIMIT 5",{"p":pid})
|
||||
# 4) Running tasks
|
||||
running = await sor.sqlExe("SELECT id,title,role FROM pipeline_tasks WHERE tenant_id=${p}$ AND state='running' LIMIT 5",{"p":pid})
|
||||
running = await sor.sqlExe("SELECT id,title,role,claimed_by,TIMESTAMPDIFF(MINUTE,updated_at,NOW()) AS mins FROM pipeline_tasks WHERE tenant_id=${p}$ AND state='running' LIMIT 5",{"p":pid})
|
||||
# 5) Review tasks
|
||||
review = await sor.sqlExe("SELECT id,title,role FROM pipeline_tasks WHERE tenant_id=${p}$ AND state='review' LIMIT 5",{"p":pid})
|
||||
lines = [f"项目诊断: {ctx['pname']}"]
|
||||
@ -441,7 +441,14 @@ async def _exec_tool(sor, tool, params, ctx, uid, org_id):
|
||||
if running:
|
||||
lines.append(f"\n🔄 运行中({len(running)}个):")
|
||||
for t in running:
|
||||
lines.append(f" [{t.role}] {t.title[:60]}")
|
||||
m = 0
|
||||
try:
|
||||
m = int(getattr(t,'mins',0) or 0)
|
||||
except Exception:
|
||||
pass
|
||||
cb = (getattr(t,'claimed_by','') or '')[:8]
|
||||
flag = f"⚠️心跳超时{m}分钟(疑似僵尸)" if m >= 10 else f"已运行{m}分钟"
|
||||
lines.append(f" [{t.role}] {t.title[:50]} | {flag} | claimed={cb}")
|
||||
if review:
|
||||
lines.append(f"\n👀 待审核({len(review)}个):")
|
||||
for t in review:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user