def wait_for_operation_async(reactor, compute, operation, timeout_steps):
 poller = _create_poller(operation)
 eliot_action = start_action(action_type=u'flocker:node:agents:gce:wait_for_operation_async', operation=operation)
 with eliot_action.context():
  def finished_operation_result():
   latest_operation = poller.poll(compute)
   if (latest_operation['status'] == 'DONE'):
    return latest_operation
   return None
  operation_deferred = loop_until(reactor, finished_operation_result, timeout_steps)
 def conclude_operation(final_operation):
  eliot_action.add_success_fields(final_operation=final_operation)
  eliot_action.finish()
  return final_operation
 operation_deferred.addCallback(conclude_operation)
 return operation_deferred

def wait_for_operation_async ( reactor , compute , operation , timeout_steps ) : poller = _create_poller ( operation ) eliot_action = start_action ( action_type = u'flocker:node:agents:gce:wait_for_operation_async' , operation = operation ) with eliot_action . context ( ) : def finished_operation_result ( ) : latest_operation = poller . poll ( compute ) if ( latest_operation [ 'status' ] == 'DONE' ) : return latest_operation return None operation_deferred = loop_until ( reactor , finished_operation_result , timeout_steps ) def conclude_operation ( final_operation ) : eliot_action . add_success_fields ( final_operation = final_operation ) eliot_action . finish ( ) return final_operation operation_deferred . addCallback ( conclude_operation ) return operation_deferred
fires a deferred once a gce operation is complete .