#NEWLINE# def _worker_start( ) : #NEWLINE# #INDENT# env = None #NEWLINE# policy = None #NEWLINE# max_length = None #NEWLINE# try : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# msgs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# msg = queue . get_nowait ( ) #NEWLINE# msgs [ msg [ 0 ] ] = msg [ 1 : ] #NEWLINE# #UNINDENT# except Empty : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# if ( 'stop' in msgs ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'update' in msgs ) : #NEWLINE# #INDENT# ( env , policy ) = msgs [ 'update' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'demo' in msgs ) : #NEWLINE# #INDENT# ( param_values , max_length ) = msgs [ 'demo' ] #NEWLINE# policy . set_param_values ( param_values ) #NEWLINE# rollout ( env , policy , max_path_length = max_length , animated = True , speedup = 5 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if max_length : #NEWLINE# #INDENT# rollout ( env , policy , max_path_length = max_length , animated = True , speedup = 5 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# pass