File size: 1,820 Bytes
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
import sys
print("Script started", flush=True)
print(f"Python: {sys.executable}", flush=True)

try:
    import httpx
    print("httpx imported OK", flush=True)
except ImportError as e:
    print(f"httpx import FAILED: {e}", flush=True)

try:
    from openai import OpenAI
    print("openai imported OK", flush=True)
except ImportError as e:
    print(f"openai import FAILED: {e}", flush=True)

try:
    from models import IncidentopsAction, IncidentopsObservation
    print("models imported OK", flush=True)
except ImportError as e:
    print(f"models import FAILED: {e}", flush=True)

try:
    from dotenv import load_dotenv
    load_dotenv()
    print("dotenv loaded OK", flush=True)
except ImportError:
    print("dotenv not available (OK)", flush=True)

import os
print(f"HF_TOKEN set: {bool(os.getenv('HF_TOKEN'))}", flush=True)
print(f"API_KEY set: {bool(os.getenv('API_KEY'))}", flush=True)

import httpx
print("\nTesting server connection...", flush=True)
try:
    r = httpx.get("http://localhost:8000/tasks", timeout=5.0)
    print(f"  /tasks status: {r.status_code}", flush=True)
    print(f"  /tasks body: {r.text}", flush=True)
except Exception as e:
    print(f"  Server error: {e}", flush=True)

try:
    r = httpx.post("http://localhost:8000/reset", json={"task_id": "incident_easy"}, timeout=5.0)
    print(f"  /reset status: {r.status_code}", flush=True)
    print(f"  /reset body: {r.text[:300]}", flush=True)
except Exception as e:
    print(f"  Reset error: {e}", flush=True)

try:
    r = httpx.post("http://localhost:8000/step", json={"action": "rollback_deploy"}, timeout=5.0)
    print(f"  /step status: {r.status_code}", flush=True)
    print(f"  /step body: {r.text[:300]}", flush=True)
except Exception as e:
    print(f"  Step error: {e}", flush=True)

print("\nAll checks done!", flush=True)