diff --git a/backend/scripts/run_reddit_simulation.py b/backend/scripts/run_reddit_simulation.py index 4d0b0ba..854eeb0 100644 --- a/backend/scripts/run_reddit_simulation.py +++ b/backend/scripts/run_reddit_simulation.py @@ -639,9 +639,18 @@ class RedditSimulationRunner: agent: LLMAction() for _, agent in active_agents } - - await self.env.step(actions) - + + print(f" Round {round_num+1}: stepping with {len(actions)} agents...", flush=True) + try: + await asyncio.wait_for(self.env.step(actions), timeout=300) + except asyncio.TimeoutError: + print(f" Round {round_num+1}: TIMEOUT after 300s, skipping", flush=True) + continue + except Exception as e: + print(f" Round {round_num+1}: ERROR {type(e).__name__}: {e}", flush=True) + continue + print(f" Round {round_num+1}: step complete", flush=True) + if (round_num + 1) % 10 == 0 or round_num == 0: elapsed = (datetime.now() - start_time).total_seconds() progress = (round_num + 1) / total_rounds * 100