#NEWLINE# def execute_action_proc( execute , action , event , queue ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# start_time = time . time ( ) #NEWLINE# result = execute ( action ) #NEWLINE# execution_time = ( time . time ( ) - start_time ) #NEWLINE# queue . put ( { #NEWLINE# #INDENT# 'status' : 'completed' , #NEWLINE# 'result' : result , #NEWLINE# 'execution_time' : execution_time , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except TaskError as err : #NEWLINE# #INDENT# queue . put ( { #NEWLINE# #INDENT# 'status' : 'failed' , #NEWLINE# 'reason' : err . reason , #NEWLINE# 'details' : err . details , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# ( _ , exc_value , _ ) = sys . exc_info ( ) #NEWLINE# queue . put ( { #NEWLINE# #INDENT# 'status' : 'failed' , #NEWLINE# 'reason' : repr ( e ) , #NEWLINE# 'details' : traceback . format_exc ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# event . set ( )