#!/usr/bin/env python3 """ComfyUI container healthcheck: the UI must answer on :8188. Runs INSIDE the container, where the UI listens (the unit publishes that port on the host loopback for the homepage status card). ComfyUI only answers once torch, the custom nodes and the graph are loaded, so a 200 here means the service is usable rather than merely a live process — the distinction that matters, because the failure this replaced was a container that stayed "up" while dying on every start. HealthCmd in the quadlet splits on spaces into an argv array (podman 5.x v1 generator), which is why this is a file and not an inline `python3 -c`. """ import sys import urllib.request try: with urllib.request.urlopen("http://127.0.0.1:8188/", timeout=10) as resp: sys.exit(0 if resp.status == 200 else 1) except Exception: sys.exit(1)