fix: vLLM probe with auth header + accept 401 as ready
Browse files- app/mellea_validator.py +8 -3
app/mellea_validator.py
CHANGED
|
@@ -391,13 +391,18 @@ def reconcile_strict_streaming(
|
|
| 391 |
try:
|
| 392 |
import httpx as _httpx
|
| 393 |
_probe_url = f"{_vllm_base}/models"
|
|
|
|
|
|
|
| 394 |
_probe_deadline = t0 + _first_token_timeout
|
| 395 |
log.info("mellea: polling vLLM readiness at %s", _probe_url)
|
| 396 |
while time.time() < _probe_deadline:
|
| 397 |
try:
|
| 398 |
-
_r = _httpx.get(_probe_url, timeout=5.0)
|
| 399 |
-
|
| 400 |
-
|
|
|
|
|
|
|
|
|
|
| 401 |
break
|
| 402 |
except Exception as _pe:
|
| 403 |
log.debug("mellea: vLLM probe: %r", _pe)
|
|
|
|
| 391 |
try:
|
| 392 |
import httpx as _httpx
|
| 393 |
_probe_url = f"{_vllm_base}/models"
|
| 394 |
+
_probe_key = os.environ.get("RIPRAP_LLM_API_KEY", "") or "EMPTY"
|
| 395 |
+
_probe_headers = {"Authorization": f"Bearer {_probe_key}"}
|
| 396 |
_probe_deadline = t0 + _first_token_timeout
|
| 397 |
log.info("mellea: polling vLLM readiness at %s", _probe_url)
|
| 398 |
while time.time() < _probe_deadline:
|
| 399 |
try:
|
| 400 |
+
_r = _httpx.get(_probe_url, headers=_probe_headers, timeout=5.0)
|
| 401 |
+
# Any non-503/502/504 means the service is UP (200 = ready,
|
| 402 |
+
# 401 = auth-gated but alive, 404 = wrong path but alive).
|
| 403 |
+
if _r.status_code not in (502, 503, 504):
|
| 404 |
+
log.info("mellea: vLLM ready (status=%d, %.1fs elapsed)",
|
| 405 |
+
_r.status_code, time.time() - t0)
|
| 406 |
break
|
| 407 |
except Exception as _pe:
|
| 408 |
log.debug("mellea: vLLM probe: %r", _pe)
|