Download tasks/cpu-decoder-graph-executor/environment/are-grader-ctx/are/drain.py from bespokelabs/AutoResearchExam: direct link, hf CLI and curl.
- Browser
- Download file 856 Bytes
-
https://huggingface.co/datasets/bespokelabs/AutoResearchExam/resolve/main/tasks/cpu-decoder-graph-executor/environment/are-grader-ctx/are/drain.py
- Command line
-
hf download hf://datasets/bespokelabs/AutoResearchExam/tasks/cpu-decoder-graph-executor/environment/are-grader-ctx/are/drain.py
-
curl -L -o drain.py https://huggingface.co/datasets/bespokelabs/AutoResearchExam/resolve/main/tasks/cpu-decoder-graph-executor/environment/are-grader-ctx/are/drain.py
856 Bytes
| """Verifier collect hook, run after the agent stops. | |
| Grades the final workspace as one last submission (unless it equals the last one), | |
| then waits until every submission has both grades recorded. | |
| """ | |
| import json | |
| import time | |
| import urllib.request | |
| from pathlib import Path | |
| TOKEN = Path("/run/are-secret/token").read_text().strip() | |
| H = {"x-are-token": TOKEN} | |
| req = urllib.request.Request("http://localhost:8000/final", method="POST", headers=H) | |
| with urllib.request.urlopen(req, timeout=120) as resp: | |
| print("final:", json.loads(resp.read()), flush=True) | |
| while True: | |
| with urllib.request.urlopen(urllib.request.Request("http://localhost:8000/drain", headers=H), timeout=30) as resp: | |
| state = json.loads(resp.read()) | |
| print(state, flush=True) | |
| if state["val_pending"] == 0 and state["test_pending"] == 0: | |
| break | |
| time.sleep(5) | |