1212import time
1313from dataclasses import dataclass
1414
15+ import httpx
1516import yaml
1617import zmq
1718
@@ -137,7 +138,7 @@ def call_pelita(team_specs, *, rounds, size, viewer, seed, timeout=3, initial_ti
137138 seed = ['--seed' , seed ] if seed else []
138139 timeout = ['--timeout' , str (timeout )]
139140 initial_timeout = ['--initial-timeout' , str (initial_timeout )]
140- publish = ['--publish ' , publish ] if publish else []
141+ publish = ['--http-post ' , publish ] if publish else []
141142 write_replay = ['--write-replay' , write_replay ] if write_replay else []
142143 store_output = ['--store-output' , store_output ] if store_output else []
143144 append_blue = ['--append-blue' , team_infos [0 ]] if team_infos [0 ] else []
@@ -306,11 +307,9 @@ def __init__(self, config):
306307 self .tournament_log_file = None
307308
308309 if self .publish :
309- ctx = zmq .Context ()
310- self .socket = ctx .socket (zmq .PUB )
311- self .socket .connect (self .publish )
310+ self .http_session = httpx .Client ()
312311 else :
313- self .socket = None
312+ self .http_session = None
314313
315314 @property
316315 def team_ids (self ):
@@ -329,13 +328,14 @@ def team_spec(self, team):
329328 return self .teams [team ]["spec" ]
330329
331330 def send_remote (self , action , data = None ):
332- if not self .socket :
331+ if not self .http_session :
333332 return
333+
334334 if data is None :
335335 publish_string = {"__action__" : action }
336336 else :
337337 publish_string = {"__action__" : action , "__data__" : data }
338- self .socket . send_json ( publish_string )
338+ self .http_session . post ( self . publish , content = json . dumps ( publish_string ) )
339339
340340 def _print (self , * args , ** kwargs ):
341341 print (* args , ** kwargs )
0 commit comments