def _async_wait_until_running(reactor, instance):
 action = start_action(action_type=u'flocker:provision:aws:wait_until_running', instance_id=instance.id)
 def check_final_state(ignored):
  if (instance.state != u'running'):
   raise FailedToRun(instance.state_reason)
  action.add_success_fields(instance_state=instance.state, instance_state_reason=instance.state_reason)
  return instance
 def finished_booting():
  d = maybeDeferred(_node_is_booting, instance)
  d.addCallback((lambda x: (not x)))
  return d
 with action.context():
  d = loop_until(reactor, finished_booting, repeat(5, INSTANCE_TIMEOUT))
  d = DeferredContext(d)
  d.addCallback(check_final_state)
  d.addActionFinish()
  return d.result

def _async_wait_until_running ( reactor , instance ) : action = start_action ( action_type = u'flocker:provision:aws:wait_until_running' , instance_id = instance . id ) def check_final_state ( ignored ) : if ( instance . state != u'running' ) : raise FailedToRun ( instance . state_reason ) action . add_success_fields ( instance_state = instance . state , instance_state_reason = instance . state_reason ) return instance def finished_booting ( ) : d = maybeDeferred ( _node_is_booting , instance ) d . addCallback ( ( lambda x : ( not x ) ) ) return d with action . context ( ) : d = loop_until ( reactor , finished_booting , repeat ( 5 , INSTANCE_TIMEOUT ) ) d = DeferredContext ( d ) d . addCallback ( check_final_state ) d . addActionFinish ( ) return d . result
wait until a instance is running .