MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / _worker_thread

Method _worker_thread

codeclash/analysis/matrix.py:226–245  ·  view source on GitHub ↗

Worker thread that processes tasks using a specific game worker.

(self, worker_id: int, task_queue: Queue)

Source from the content-addressed store, hash-verified

224 return (i, j, result)
225
226 def _worker_thread(self, worker_id: int, task_queue: Queue):
227 """Worker thread that processes tasks using a specific game worker."""
228 game_worker = self.game_pool[worker_id]
229 self.logger.debug(f"Worker {worker_id} started")
230
231 while True:
232 try:
233 task = task_queue.get(timeout=1) # Short timeout to allow clean exit
234 except:
235 # Queue is empty and no more tasks coming
236 break
237
238 try:
239 self._evaluate_matrix_cell_parallel(game_worker, **task)
240 except Exception as e:
241 self.logger.error(f"Worker {worker_id} failed on task {task}: {e}")
242 finally:
243 task_queue.task_done()
244
245 self.logger.debug(f"Worker {worker_id} stopped")
246
247 def _evaluate_matrix(self, player1_name: str, player2_name: str):
248 """Evaluate a matrix between two players using manual thread management."""

Callers

nothing calls this directly

Calls 2

getMethod · 0.80

Tested by

no test coverage detected