def start_server(data_stream, port=5557, hwm=20):
 logging.basicConfig(level='INFO')
 context = zmq.Context()
 socket = context.socket(zmq.PUSH)
 socket.set_hwm(hwm)
 socket.bind('tcp://*:{}'.format(port))
 it = data_stream
 logger.info('server started')
 while True:
  try:
   data = next(it)
   stop = False
   logger.debug('sending {} arrays'.format(len(data)))
  except StopIteration:
   it = data_stream
   data = None
   stop = True
   logger.debug('sending StopIteration')
  send_arrays(socket, data, stop=stop)

def start_server ( data_stream , port = 5557 , hwm = 20 ) : logging . basicConfig ( level = 'INFO' ) context = zmq . Context ( ) socket = context . socket ( zmq . PUSH ) socket . set_hwm ( hwm ) socket . bind ( 'tcp://*:{}' . format ( port ) ) it = data_stream logger . info ( 'server started' ) while True : try : data = next ( it ) stop = False logger . debug ( 'sending {} arrays' . format ( len ( data ) ) ) except StopIteration : it = data_stream data = None stop = True logger . debug ( 'sending StopIteration' ) send_arrays ( socket , data , stop = stop )
start all instances for the given version of the server .