MCPcopy Create free account
hub / github.com/commaai/research / client_generator

Function client_generator

server.py:93–117  ·  view source on GitHub ↗

Generator in client side should extend this generator Parameters ---------- port : int hwm : int, optional The `ZeroMQ high-water mark (HWM) `_ on the sending socket. Increasing this increases the buffer, which can be useful if yo

(port=5557, host="localhost", hwm=20)

Source from the content-addressed store, hash-verified

91
92
93def client_generator(port=5557, host="localhost", hwm=20):
94 """Generator in client side should extend this generator
95
96 Parameters
97 ----------
98
99 port : int
100 hwm : int, optional
101 The `ZeroMQ high-water mark (HWM)
102 <http://zguide.zeromq.org/page:all#High-Water-Marks>`_ on the
103 sending socket. Increasing this increases the buffer, which can be
104 useful if your data preprocessing times are very random. However,
105 it will increase memory usage. There is no easy way to tell how
106 many batches will actually be queued with a particular HWM.
107 Defaults to 10. Be sure to set the corresponding HWM on the
108 receiving end as well.
109 """
110 context = zmq.Context()
111 socket = context.socket(zmq.PULL)
112 socket.set_hwm(hwm)
113 socket.connect("tcp://{}:{}".format(host, port))
114 logger.info('client started')
115 while True:
116 data = recv_arrays(socket)
117 yield tuple(data)
118
119
120def start_server(data_stream, port=5557, hwm=20):

Callers 3

genFunction · 0.90
genFunction · 0.90

Calls 1

recv_arraysFunction · 0.85

Tested by

no test coverage detected