Timeout on zmq to allow gracefull exit

This commit is contained in:
Ruben van de Ven 2023-10-22 14:25:34 +02:00
parent 3091557733
commit fd2e8a3b49

View file

@ -242,6 +242,11 @@ class PredictionServer:
if self.config.predict_training_data: if self.config.predict_training_data:
input_dict = eval_scene.get_clipped_input_dict(timestep, hyperparams['state']) input_dict = eval_scene.get_clipped_input_dict(timestep, hyperparams['state'])
else: else:
zmq_ev = self.trajectory_socket.poll(timeout=3)
if not zmq_ev:
# on no data loop so that is_running is checked
continue
data = self.trajectory_socket.recv() data = self.trajectory_socket.recv()
frame: Frame = pickle.loads(data) frame: Frame = pickle.loads(data)
trajectory_data = frame.trajectories # TODO: properly refractor trajectory_data = frame.trajectories # TODO: properly refractor