@@ -30,11 +30,9 @@ def _wait_for_ports(self, ports: list[int], timeout: float = 3.0) -> None:
3030 for port in ports :
3131 result = self .environment .execute (f"nc -z 0.0.0.0 { port } " )
3232 if result ["returncode" ] != 0 :
33- self .logger .debug (f"Port { port } is not ready" )
3433 break
3534 else :
3635 # All ports are ready (loop completed without break)
37- self .logger .info ("All ports are ready" )
3836 return
3937
4038 time .sleep (0.1 )
@@ -52,17 +50,20 @@ def get_stats(self, result_outputs: list[str], agents: list[Player]) -> RoundSta
5250 return RoundStats (winner = winner , scores = scores )
5351
5452 def execute_round (self , agents : list [Player ]) -> RoundData :
53+ self .logger .debug ("Starting game servers" )
5554 cmd = []
5655 ports = []
5756 for idx , agent in enumerate (agents ):
5857 port = 8001 + idx
5958 ports .append (port )
59+ # Surprisingly slow despite using &
6060 # Start server in background - just add & to run in background!
6161 self .environment .execute (f"PORT={ port } python main.py &" , cwd = f"/{ agent .name } " )
6262 cmd .append (f"--url http://0.0.0.0:{ port } -n { agent .name } " )
6363
64- # Wait for all servers to be ready (up to 3 seconds )
64+ self . logger . debug ( f"Waiting for ports: { ports } " )
6565 self ._wait_for_ports (ports )
66+ self .logger .debug ("All ports are ready" )
6667
6768 try :
6869 log_outputs , result_outputs = [], []
0 commit comments