MCPcopy Create free account
hub / github.com/SkyworkAI/DeepResearchAgent / process_task

Function process_task

tests/leetcode_reflection_agent.py:1178–1210  ·  view source on GitHub ↗

处理单个任务

(task: Task)

Source from the content-addressed store, hash-verified

1176 start_time = time.time()
1177
1178 async def process_task(task: Task):
1179 """处理单个任务"""
1180 result_task = await inference_with_reflection(
1181 task=task,
1182 save_dir=save_dir,
1183 semaphore=inference_semaphore,
1184 benchmark=benchmark,
1185 )
1186
1187 async with stats_lock:
1188 stats["completed"] += 1
1189 score = result_task.score or 0.0
1190
1191 if score >= 1.0:
1192 stats["accepted"] += 1
1193 elif score > 0:
1194 stats["partial"] += 1
1195 else:
1196 stats["failed"] += 1
1197
1198 final_round = result_task.extra.get("final_round", MAX_REFLECTION_ROUNDS)
1199 stats["total_rounds"] += final_round
1200
1201 # 打印进度
1202 print(f"\r🔄 Progress: {stats['completed']}/{total_tasks} | "
1203 f"✅ Accepted: {stats['accepted']} | "
1204 f"🔶 Partial: {stats['partial']} | "
1205 f"❌ Failed: {stats['failed']}", end="", flush=True)
1206
1207 # 保存最终结果
1208 await save_final_result(result_task, benchmark, save_dir)
1209
1210 return result_task
1211
1212 # 启动所有任务
1213 print(f"🚀 Starting self-reflection inference...\n")

Callers 1

Calls 4

printFunction · 0.85
save_final_resultFunction · 0.70
getMethod · 0.45

Tested by 1