#!/usr/bin/env python3 """frank-medium container healthcheck: the port's /health must answer 200. Runs INSIDE the container. The vLLM /health endpoint only answers once the engine is up (weights loaded, cudagraphs captured), so a healthy container is a serving container, not merely a live process. PORT selects the endpoint so the probe follows the unit's Environment=PORT rather than hard-coding the fleet port. The HealthCmd in the quadlet splits on spaces into an argv array (podman 5.x v1 generator), which is why this lives in a file rather than an inline python one-liner. """ import os import sys import urllib.request port = os.environ.get("PORT", "7770") try: with urllib.request.urlopen(f"http://127.0.0.1:{port}/health", timeout=5) as r: sys.exit(0 if r.status == 200 else 1) except Exception: sys.exit(1)