INNER CODE UNIT · Python
_restart_dead_yolo_workers
yihong1120/Construction-Hazard-Detection · main.py:598
def _restart_dead_yolo_workers(self, devices: list[str]) -> None:
"""Replace dead workers while preserving fixed native IPC queues."""
for worker_index, process in enumerate(self.yolo_worker_processes):
if process.is_alive():
continue
with suppress(Exception):
process.join()
request_queue = self.yolo_request_queues[worker_index]
device = devices[worker_index % len(devices)]
self.yolo_worker_processes[worker_index] = self._start_yolo_worker(
worker_index,
request_queue,
device,
)
self.logger.warning(
'[YOLO-Worker] process %s exited; restarted with existing '
'IPC broker on %s',
worker_index,