def _wait_until_running(instance):
 with start_action(action_type=u'flocker:provision:aws:wait_until_running', instance_id=instance.id) as context:
  _poll_while((lambda : _node_is_booting(instance)), repeat(1, INSTANCE_TIMEOUT))
  context.add_success_fields(instance_state=instance.state)
  context.add_success_fields(instance_state_reason=instance.state_reason)
 if (instance.state != u'running'):
  raise FailedToRun(instance.state_reason)

def _wait_until_running ( instance ) : with start_action ( action_type = u'flocker:provision:aws:wait_until_running' , instance_id = instance . id ) as context : _poll_while ( ( lambda : _node_is_booting ( instance ) ) , repeat ( 1 , INSTANCE_TIMEOUT ) ) context . add_success_fields ( instance_state = instance . state ) context . add_success_fields ( instance_state_reason = instance . state_reason ) if ( instance . state != u'running' ) : raise FailedToRun ( instance . state_reason )
wait until a instance is running .