yau-plant-assistant/api/app_healthcheck.py
Claude 34d2ccc576 Scaffold the WRPS plant operations assistant repository
Build spec and host brief carried in from C:\Claude and WRPS/02-env; the
plant model (equipment, tags, alarm bitmask, enums, unit conversions) is
derived from WRPS/04-plc/register-map.csv, WRPS/05-scada/modbus/scada-points.csv
and WRPS-CTL-003.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 13:56:32 +10:00

15 lines
508 B
Python

"""Container healthcheck. `python -m app_healthcheck` from ai-compose.yml.
Exits 0 only if the process answers /healthz. It deliberately does not check
Cube or imh - an unreachable upstream is a degraded API, not a dead container,
and flapping the container makes that harder to diagnose, not easier.
"""
import sys
import urllib.request
try:
with urllib.request.urlopen("http://localhost:8000/healthz", timeout=4) as r:
sys.exit(0 if r.status == 200 else 1)
except Exception:
sys.exit(1)