#NEWLINE# def _pretend_to_run_a_flow_and_crash( self , when ) : #NEWLINE# #INDENT# flow = uf . Flow ( 'flow-1' , retry . Times ( 3 , provides = 'x' ) ) . add ( utils . ProgressingTask ( 'task1' ) ) #NEWLINE# engine = self . _make_engine ( flow ) #NEWLINE# engine . compile ( ) #NEWLINE# engine . prepare ( ) #NEWLINE# engine . storage . set_flow_state ( st . RUNNING ) #NEWLINE# engine . storage . set_atom_intention ( 'flow-1_retry' , st . EXECUTE ) #NEWLINE# engine . storage . set_atom_intention ( 'task1' , st . EXECUTE ) #NEWLINE# engine . storage . save ( 'flow-1_retry' , 1 ) #NEWLINE# fail = failure . Failure . from_exception ( RuntimeError ( 'foo' ) ) #NEWLINE# engine . storage . save ( 'task1' , fail , state = st . FAILURE ) #NEWLINE# if ( when == 'task fails' ) : #NEWLINE# #INDENT# return engine #NEWLINE# #UNINDENT# engine . storage . save_retry_failure ( 'flow-1_retry' , 'task1' , fail ) #NEWLINE# if ( when == 'retry queried' ) : #NEWLINE# #INDENT# return engine #NEWLINE# #UNINDENT# engine . storage . set_atom_intention ( 'flow-1_retry' , st . RETRY ) #NEWLINE# if ( when == 'retry updated' ) : #NEWLINE# #INDENT# return engine #NEWLINE# #UNINDENT# engine . storage . set_atom_intention ( 'task1' , st . REVERT ) #NEWLINE# if ( when == 'task updated' ) : #NEWLINE# #INDENT# return engine #NEWLINE# #UNINDENT# engine . storage . set_atom_state ( 'task1' , st . REVERTING ) #NEWLINE# if ( when == 'revert scheduled' ) : #NEWLINE# #INDENT# return engine #NEWLINE# #UNINDENT# raise ValueError ( ( 'Invalid crash point: %s' % when ) )