Download code/scripts/probe.py from JagritGumber/shortlist: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/datasets/JagritGumber/shortlist/resolve/main/code/scripts/probe.py
- Command line
-
hf download hf://datasets/JagritGumber/shortlist/code/scripts/probe.py
-
curl -L -o probe.py https://huggingface.co/datasets/JagritGumber/shortlist/resolve/main/code/scripts/probe.py
1.25 kB
| """Start each environment, save its /schema and a first reset(), and report whether it came up.""" | |
| import json | |
| import sys | |
| from pathlib import Path | |
| import requests | |
| sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) | |
| from shortlist.serve import APPS, ROOT, serve # noqa: E402 | |
| out = ROOT / "runs" / "probe" | |
| out.mkdir(parents=True, exist_ok=True) | |
| wanted = sys.argv[1:] or list(APPS) | |
| for env in wanted: | |
| try: | |
| with serve(env) as url: | |
| schema = requests.get(f"{url}/schema", timeout=30).json() | |
| meta = requests.get(f"{url}/metadata", timeout=30).json() | |
| reset = requests.post(f"{url}/reset", json={}, timeout=120) | |
| body = reset.json() if reset.headers.get("content-type", "").startswith("application/json") else reset.text | |
| (out / f"{env}.json").write_text(json.dumps({"schema": schema, "metadata": meta, "reset": body}, indent=2)) | |
| action = schema.get("action", {}) | |
| print(f"up {env:28s} action fields: {list(action.get('properties', {}))[:8]} reset {reset.status_code}") | |
| except Exception as error: # noqa: BLE001 - a broken environment is a result, not a crash | |
| print(f"DOWN {env:28s} {type(error).__name__}: {str(error)[:200]}") | |