def main(self) -> None: with ipc.ZMQBroadcastClient(self._pub_url, self._pull_url) as broadcast_client: # Start the server-client communication test. broadcast_client.send(ipc.ReadyMessage()) for exp in self._exp_msgs: msg = broadcast_client.recv() assert msg == exp broadcast_client.send(2 * msg)
def __iter__(self) -> workload.Stream: # Signal to the CoordinatingTrialController that we are ready for workloads. self._broadcast_client.send(ipc.ReadyMessage()) while True: obj = self._broadcast_client.recv() wkld, args = cast(Tuple[workload.Workload, List[Any]], obj) def _respond(message: Any) -> None: self._broadcast_client.send(message) yield wkld, args, _respond