def __init__(self, broadcast_client: ipc.ZMQBroadcastClient): self._broadcast_client = broadcast_client # Signal to the SubprocessLauncher that the subprocess has started and # send the process id so that the SubprocessLauncher can perform health # checks on it. self._broadcast_client.send( ipc.ConnectedMessage(process_id=os.getpid()))
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.ConnectedMessage(process_id=0)) for exp in self._exp_msgs: msg = broadcast_client.recv() assert msg == exp broadcast_client.send(2 * msg)
def __init__(self, broadcast_client: ipc.ZMQBroadcastClient): self._broadcast_client = broadcast_client # Signal to the SubprocessLauncher that the subprocess has started and # send the process id so that the SubprocessLauncher can perform health # checks on it. self._broadcast_client.send(ipc.ConnectedMessage(process_id=os.getpid())) # Avoid hangs when receiving from the broadcast server. Run this after sending the # ConnectedMessage so that the broadcast server has a pid for running a healthcheck while # this runs. self._broadcast_client.safe_start()