(self)
| 26 | |
| 27 | |
| 28 | class ControllerService(BaseService): |
| 29 | def __init__(self): |
| 30 | super().__init__() |
| 31 | self.rdma_buffer_request: RDMABuffer | None = None |
| 32 | self.rdma_buffer_phase1: RDMABuffer | None = None |
| 33 | self.rdma_buffer_phase2: RDMABuffer | None = None |
| 34 | self.encoder_policy = RoundRobinPolicy() |
| 35 | self.transformer_policy = RoundRobinPolicy() |
| 36 | self.decoder_policy = RoundRobinPolicy() |
| 37 | self._lock = Lock() |
| 38 | self.req_mgr = ReqManager() |
| 39 | self.monitor = Monitor(nodes=[]) |
| 40 | self._rdma_server_request: RDMAServer | None = None |
| 41 | self._rdma_server_phase1: RDMAServer | None = None |
| 42 | self._rdma_server_phase2: RDMAServer | None = None |
| 43 | self._rdma_handshake_thread_request: Thread | None = None |
| 44 | self._rdma_handshake_thread_phase1: Thread | None = None |
| 45 | self._rdma_handshake_thread_phase2: Thread | None = None |
| 46 | self._instance_lock = Lock() |
| 47 | self._free_gpus: set[int] = set() |
| 48 | self._managed_instances: dict[str, dict[str, Any]] = {} |
| 49 | self.started_instances: list[tuple[str, str]] = [] |
| 50 | self._runtime_config: dict[str, Any] | None = None |
| 51 | self._bootstrap_addr: str = "127.0.0.1" |
| 52 | self._gpu_reuse_block_until: dict[int, float] = {} |
| 53 | self._gpu_reuse_grace_seconds: float = 5.0 |
| 54 | self._graceful_reclaim_timeout_seconds: float = float(os.getenv("DISAGG_RECLAIM_GRACEFUL_TIMEOUT_SECONDS", "30.0")) |
| 55 | self._force_kill_wait_seconds: float = float(os.getenv("DISAGG_RECLAIM_FORCE_KILL_WAIT_SECONDS", "1.0")) |
| 56 | self._instance_start_timeout_seconds: float = float(os.getenv("DISAGG_INSTANCE_START_TIMEOUT_SECONDS", "90.0")) |
| 57 | self._sidecar_start_timeout_seconds: float = float(os.getenv("DISAGG_SIDECAR_START_TIMEOUT_SECONDS", "15.0")) |
| 58 | self._sidecar_drain_idle_seconds: float = float(os.getenv("DISAGG_SIDECAR_DRAIN_IDLE_SECONDS", "1.0")) |
| 59 | # <= 0 means wait indefinitely until sidecar pending queues are drained. |
| 60 | self._sidecar_drain_timeout_seconds: float = float(os.getenv("DISAGG_SIDECAR_DRAIN_TIMEOUT_SECONDS", "0")) |
| 61 | self._remote_proxy_start_timeout_seconds: float = float(os.getenv("DISAGG_REMOTE_PROXY_START_TIMEOUT_SECONDS", "20.0")) |
| 62 | self._sidecar_reclaim_threads: list[Thread] = [] |
| 63 | self._shutting_down: bool = False |
| 64 | self._enable_monitor: bool = False |
| 65 | self._static_instance_slots: list[dict[str, Any]] = [] |
| 66 | self._free_slot_ids: set[int] = set() |
| 67 | self._slot_reuse_block_until: dict[int, float] = {} |
| 68 | self._local_host_aliases: set[str] = set() |
| 69 | self._request_metrics_by_room: dict[int, dict[str, Any]] = {} |
| 70 | self._monitor_samples: list[dict[str, Any]] = [] |
| 71 | self._controller_start_ts: float | None = None |
| 72 | self._metrics_output_json = Path( |
| 73 | os.getenv( |
| 74 | "DISAGG_CONTROLLER_METRICS_OUTPUT_JSON", |
| 75 | str(Path(__file__).resolve().parents[3] / "save_results" / "disagg_controller_metrics.json"), |
| 76 | ) |
| 77 | ) |
| 78 | |
| 79 | def _is_monitor_enabled(self) -> bool: |
nothing calls this directly
no test coverage detected