Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions inference/core/interfaces/http/http_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2521,12 +2521,25 @@ def readiness(
)

@app.get("/healthz", status_code=200)
def healthz():
def healthz(
state: ModelInitState = Depends(lambda: model_init_state),
):
"""Health endpoint for Kubernetes liveness probe.

Verifies CUDA context health when running on GPU. Returns 503 if
CUDA is corrupted (unrecoverable - requires process restart).
CUDA is corrupted (unrecoverable - requires process restart) or
if model initialization has not completed yet.
"""
with state.lock:
if not state.is_ready:
return JSONResponse(
content={
"status": "unhealthy",
"reason": "not_ready",
},
status_code=503,
)

from inference.core.utils.cuda_health import check_cuda_health

is_healthy, error = check_cuda_health()
Expand Down
Loading