Processes/threads got stuck in queue.get() operations which normally block indefinitely. This commit adds timeouts with required checks to quit when exit_flags are set to True.
Added exit_flag for ProcessStats.
Added long timeout for receiving prediction in ProcessAgent. I don't see why this hangs at times but during tests there were rare cases where this part hanged.
The code "overshoots" the number of episodes defined in Config before closing. With EPISODES=10 my run reaches ~60 episodes before closing.
Edit: Actually this could be made better by using multiprocessing.Queue.close. It would still require try-excepts but would avoid using get every 0.001 seconds.
Processes/threads got stuck in queue.get() operations which normally block indefinitely. This commit adds timeouts with required checks to quit when exit_flags are set to True. Added exit_flag for ProcessStats. Added long timeout for receiving prediction in ProcessAgent. I don't see why this hangs at times but during tests there were rare cases where this part hanged.
The code "overshoots" the number of episodes defined in Config before closing. With EPISODES=10 my run reaches ~60 episodes before closing.
Edit: Actually this could be made better by using
multiprocessing.Queue.close
. It would still require try-excepts but would avoid usingget
every 0.001 seconds.