INNER CODE UNIT · Python
_has_yolo_worker_broker
yihong1120/Construction-Hazard-Detection · main.py:586
def _has_yolo_worker_broker(
self,
worker_count: int,
topology_signature: str | None = None,
) -> bool:
"""Return whether existing worker IPC can be reused safely."""
return (
len(self.yolo_request_queues) == worker_count
and len(self.yolo_worker_processes) == worker_count
and self.yolo_worker_topology_signature == topology_signature
)
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):