MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / add_batch_log

Method add_batch_log

src/web/task_manager.py:250–264  ·  view source on GitHub ↗

添加批量任务日志并推送

(self, batch_id: str, log_message: str)

Source from the content-addressed store, hash-verified

248 logger.info(f"批量任务 {batch_id} 已初始化,总数: {total}")
249
250 def add_batch_log(self, batch_id: str, log_message: str):
251 """添加批量任务日志并推送"""
252 # 先广播到 WebSocket,确保实时推送
253 if self._loop and self._loop.is_running():
254 try:
255 asyncio.run_coroutine_threadsafe(
256 self._broadcast_batch_log(batch_id, log_message),
257 self._loop
258 )
259 except Exception as e:
260 logger.warning(f"推送批量日志到 WebSocket 失败: {e}")
261
262 # 广播后再添加到队列
263 with _get_batch_lock(batch_id):
264 _batch_logs[batch_id].append(log_message)
265
266 async def _broadcast_batch_log(self, batch_id: str, log_message: str):
267 """广播批量任务日志"""

Callers 3

callbackMethod · 0.95
add_batch_logFunction · 0.80

Calls 3

_broadcast_batch_logMethod · 0.95
_get_batch_lockFunction · 0.85
warningMethod · 0.80

Tested by

no test coverage detected