rb125 commited on
Commit
7ece369
·
1 Parent(s): 5576e74

add debug logging to economy runner for HF Spaces

Browse files
Files changed (1) hide show
  1. server/api.py +11 -0
server/api.py CHANGED
@@ -50,6 +50,11 @@ def _run_economy(num_rounds: int, initial_balance: float):
50
  from dotenv import load_dotenv
51
  load_dotenv(Path(__file__).resolve().parents[1] / ".env", override=True)
52
 
 
 
 
 
 
53
  from server.live_runner import LiveSimulationRunner, LiveSimConfig
54
 
55
  config = LiveSimConfig(
@@ -62,13 +67,16 @@ def _run_economy(num_rounds: int, initial_balance: float):
62
  test_eth_top_up_amount=0.3,
63
  )
64
 
 
65
  runner = LiveSimulationRunner(config)
66
 
67
  with _state_lock:
68
  _state["status"] = "setup"
69
  _state["total_rounds"] = num_rounds
70
 
 
71
  runner.setup()
 
72
 
73
  with _state_lock:
74
  _state["status"] = "running"
@@ -153,6 +161,9 @@ def _run_economy(num_rounds: int, initial_balance: float):
153
  round_num += 1
154
 
155
  except Exception as e:
 
 
 
156
  logger.exception(f"Economy runner failed: {e}")
157
  finally:
158
  with _state_lock:
 
50
  from dotenv import load_dotenv
51
  load_dotenv(Path(__file__).resolve().parents[1] / ".env", override=True)
52
 
53
+ print(f"[CGAE] Starting economy: rounds={num_rounds}, balance={initial_balance}", flush=True)
54
+ print(f"[CGAE] AZURE_API_KEY set: {bool(os.environ.get('AZURE_API_KEY'))}", flush=True)
55
+ print(f"[CGAE] AWS_BEARER_TOKEN_BEDROCK set: {bool(os.environ.get('AWS_BEARER_TOKEN_BEDROCK'))}", flush=True)
56
+ print(f"[CGAE] PRIVATE_KEY set: {bool(os.environ.get('PRIVATE_KEY'))}", flush=True)
57
+
58
  from server.live_runner import LiveSimulationRunner, LiveSimConfig
59
 
60
  config = LiveSimConfig(
 
67
  test_eth_top_up_amount=0.3,
68
  )
69
 
70
+ print("[CGAE] Creating LiveSimulationRunner...", flush=True)
71
  runner = LiveSimulationRunner(config)
72
 
73
  with _state_lock:
74
  _state["status"] = "setup"
75
  _state["total_rounds"] = num_rounds
76
 
77
+ print("[CGAE] Running setup...", flush=True)
78
  runner.setup()
79
+ print("[CGAE] Setup complete, starting rounds...", flush=True)
80
 
81
  with _state_lock:
82
  _state["status"] = "running"
 
161
  round_num += 1
162
 
163
  except Exception as e:
164
+ import traceback
165
+ print(f"[CGAE] Economy runner FAILED: {e}", flush=True)
166
+ traceback.print_exc()
167
  logger.exception(f"Economy runner failed: {e}")
168
  finally:
169
  with _state_lock: