Spaces:
Sleeping
Sleeping
File size: 2,089 Bytes
66ae73a 2c99c28 66ae73a 2c99c28 66ae73a 2c99c28 66ae73a 2c99c28 66ae73a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | import sys
print("1. Script started", flush=True)
print("2. Testing imports...", flush=True)
try:
from dotenv import load_dotenv
load_dotenv()
print("3. dotenv OK", flush=True)
except Exception as e:
print(f"3. dotenv error: {e}", flush=True)
try:
import httpx
print("4. httpx OK", flush=True)
except Exception as e:
print(f"4. httpx FAILED: {e}", flush=True)
sys.exit(1)
try:
from openai import OpenAI
print("5. openai OK", flush=True)
except Exception as e:
print(f"5. openai FAILED: {e}", flush=True)
sys.exit(1)
import os
print(f"6. HF_TOKEN={'set' if os.getenv('HF_TOKEN') else 'missing'}", flush=True)
print("7. Testing server...", flush=True)
try:
r = httpx.get("http://localhost:8000/tasks", timeout=5.0)
print(f"8. Server response: {r.status_code}", flush=True)
except Exception as e:
print(f"8. Server error: {e}", flush=True)
sys.exit(1)
print("9. Testing reset...", flush=True)
try:
r = httpx.post("http://localhost:8000/reset", json={"task_id": "incident_easy"}, timeout=5.0)
print(f"10. Reset status: {r.status_code}", flush=True)
data = r.json()
obs = data.get("observation", data)
print(f"11. Alert: {obs.get('alert_summary', 'N/A')[:50]}", flush=True)
except Exception as e:
print(f"10. Reset error: {e}", flush=True)
sys.exit(1)
print("12. Testing step...", flush=True)
try:
r = httpx.post(
"http://localhost:8000/step",
json={"action": {"action": "rollback_deploy"}},
timeout=5.0,
)
print(f"13. Step status: {r.status_code}", flush=True)
print(f"14. Step body: {r.text[:200]}", flush=True)
except Exception as e:
print(f"13. Step error: {e}", flush=True)
print("15. Testing grade...", flush=True)
try:
r = httpx.get("http://localhost:8000/grade", params={"task_id": "incident_easy"}, timeout=5.0)
print(f"16. Grade status: {r.status_code}", flush=True)
print(f"17. Grade body: {r.text[:200]}", flush=True)
except Exception as e:
print(f"16. Grade error: {e}", flush=True)
print("18. ALL DONE", flush=True) |