feat: MLX /status API 통합 — GPU 무접촉 부하 측정
- model_adapter.status_check(): GET /status, 미지원 백엔드는 None - backend_registry.get_load_status(): /status API 1순위, hybrid fallback - active_jobs >=4 매우 바쁨, >=2 바쁨, =1 보통, =0 여유 - source: status_api | hybrid 표시 - worker._build_system_status(): source별 분기, active_jobs/total_requests 표시 - hybrid 경로의 self-job 제외 (active > 1) - health loop에서 status도 같이 캐시 (지원 백엔드만) Mac mini /opt/mlx-proxy.py에 active_jobs 카운터 + /status 엔드포인트 추가됨 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -116,6 +116,19 @@ class ModelAdapter:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
async def status_check(self) -> dict | None:
|
||||
"""GET /status — 백엔드가 지원하는 경우만. 없으면 None."""
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=3.0) as client:
|
||||
resp = await client.get(f"{self.base_url}/status")
|
||||
if resp.status_code == 200:
|
||||
data = resp.json()
|
||||
if "active_jobs" in data:
|
||||
return data
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
|
||||
async def measure_inference_latency(self) -> float:
|
||||
"""ping 메시지로 실제 inference latency 측정. max_tokens=1로 최소 부하.
|
||||
반환: 밀리초. 실패 시 -1.0"""
|
||||
|
||||
Reference in New Issue
Block a user