dp-zp-agent/tools/runtime_health.py

14 lines
355 B
Python

"""Container readiness: HTTP 200 alone does not mean that indexes are ready."""
import json
import urllib.request
def main():
with urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=8) as response:
health = json.load(response)
raise SystemExit(0 if health.get('ready') is True else 1)
if __name__ == '__main__':
main()