Update app.py
Browse files
app.py
CHANGED
@@ -504,25 +504,21 @@ async def warmup_start(payload: Optional[Dict[str, Any]] = Body(None)):
|
|
504 |
|
505 |
@app.get("/warmup/status", tags=["warmup"])
|
506 |
def warmup_status():
|
507 |
-
"""
|
508 |
-
|
|
|
509 |
data = deepcopy(warmup_state)
|
510 |
-
|
511 |
-
data["instance_id"] = INSTANCE_ID
|
512 |
-
# --- AJOUT : état du cache actuel ---
|
513 |
-
cached = _list_cached_repos()
|
514 |
-
data["audit_count"] = len(cached)
|
515 |
-
data["audit_cached"] = cached
|
516 |
-
# --- FIN AJOUT ---
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
|
|
|
|
|
|
|
|
|
522 |
|
523 |
data["ts"] = time.time()
|
524 |
return data
|
525 |
|
|
|
526 |
@app.post("/warmup/stop", tags=["warmup"])
|
527 |
def warmup_stop_api():
|
528 |
""" Demande l'arrêt propre (on termine le modèle en cours puis on stoppe). """
|
|
|
504 |
|
505 |
@app.get("/warmup/status", tags=["warmup"])
|
506 |
def warmup_status():
|
507 |
+
"""Retourne l'état courant du warm-up (progression, logs, etc.)."""
|
508 |
+
# On copie l'état sous verrou pour éviter les lectures concurrentes
|
509 |
+
with warmup_lock:
|
510 |
data = deepcopy(warmup_state)
|
511 |
+
data["instance_id"] = INSTANCE_ID # aide au diagnostic multi-répliques
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
|
513 |
+
# Infos d’audit du cache (peut se faire hors verrou)
|
514 |
+
cached = _list_cached_repos()
|
515 |
+
data["audit_count"] = len(cached)
|
516 |
+
data["audit_cached"] = cached
|
517 |
|
518 |
data["ts"] = time.time()
|
519 |
return data
|
520 |
|
521 |
+
|
522 |
@app.post("/warmup/stop", tags=["warmup"])
|
523 |
def warmup_stop_api():
|
524 |
""" Demande l'arrêt propre (on termine le modèle en cours puis on stoppe). """
|