#NEWLINE# def _run_action( self , liveaction , wait_for_completion = True , sleep_delay = 1.0 ) : #NEWLINE# #INDENT# '\n        :param sleep_delay: Number of seconds to wait during "is completed" polls.\n        :type sleep_delay: ``float``\n        ' #NEWLINE# try : #NEWLINE# #INDENT# ( liveaction , _ ) = action_service . request ( liveaction ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# liveaction . status = LIVEACTION_STATUS_FAILED #NEWLINE# LOG . exception ( 'Failed to schedule liveaction.' ) #NEWLINE# raise e #NEWLINE# #UNINDENT# while ( wait_for_completion and ( liveaction . status not in LIVEACTION_COMPLETED_STATES ) ) : #NEWLINE# #INDENT# eventlet . sleep ( sleep_delay ) #NEWLINE# liveaction = action_db_util . get_liveaction_by_id ( liveaction . id ) #NEWLINE# #UNINDENT# return liveaction