MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / worker

Method worker

internbootcamp/src/base_evaluator.py:747–762  ·  view source on GitHub ↗
(idx, input_data)

Source from the content-addressed store, hash-verified

745 file_write_lock = asyncio.Lock()
746
747 async def worker(idx, input_data):
748 async with semaphore:
749 result = await self._evaluate_one(input_data)
750 results[idx] = result
751 if output_path:
752 async with file_write_lock:
753 with open(output_path, "a", encoding="utf-8") as f:
754 try:
755 f.write(json.dumps(result, ensure_ascii=False) + "\n")
756 except Exception as e:
757 print(f"❌ 写入结果失败: {e}")
758 print(f"❌ 写入结果: {result}")
759
760 # 任务完成时立即更新进度条
761 async with progress_lock:
762 progress_bar.update(1)
763
764 # 创建所有任务
765 tasks = [worker(idx, input_data) for idx, input_data in enumerate(input_list)]

Callers

nothing calls this directly

Calls 3

_evaluate_oneMethod · 0.95
writeMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected