| import requests |
| import time |
|
|
| BASE_URL = "http://localhost:8000" |
|
|
| def check_task(task_id): |
| print(f"\n--- Testing Task: {task_id} ---") |
| |
| r = requests.post(f"{BASE_URL}/reset", json={"task_name": task_id}) |
| if r.status_code != 200: |
| print(f"β Reset failed: {r.status_code}") |
| return False |
| |
| obs = r.json() |
| print(f"β
Reset: Grid={obs['grid_width']}x{obs['grid_height']}, Target={obs['current_target']}") |
| |
| |
| |
| score = obs['score'] |
| if 0.01 <= score <= 0.99: |
| print(f"β
Initial Score check: {score} (within 0.01-0.99)") |
| else: |
| print(f"β Initial Score out of range: {score}") |
| return False |
| |
| |
| r = requests.get(f"{BASE_URL}/grade/{task_id}") |
| if r.status_code != 200: |
| print(f"β Grader endpoint failed: {r.status_code}") |
| return False |
| |
| grade_res = r.json() |
| print(f"β
Grader score: {grade_res['score']} (matches obs: {grade_res['score'] == score})") |
| return True |
|
|
| def run_checks(): |
| |
| for _ in range(5): |
| try: |
| requests.get(f"{BASE_URL}/health") |
| break |
| except: |
| time.sleep(2) |
| |
| |
| r = requests.get(f"{BASE_URL}/graders") |
| graders = r.json().get('graders', []) |
| print(f"\n--- Discovering Graders ---") |
| print(f"β
Found {len(graders)} graders: {graders}") |
| |
| expected = ["easy_delivery", "medium_delivery", "hard_delivery"] |
| for t in expected: |
| if t not in graders: |
| print(f"β Missing task: {t}") |
| return |
| |
| |
| for t in expected: |
| if not check_task(t): |
| print(f"\nβ FINAL CHECK FAILED ON {t}") |
| return |
| |
| print("\n" + "="*40) |
| print("π ALL CHECKS PASSED: Environment is GOLDEN") |
| print("="*40) |
|
|
| if __name__ == "__main__": |
| run_checks() |
|
|