def upload_error(f, snap): write_failure(f) if f.check(CancelledError): self._factory._folder_status.error_occurred( "Cancelled: {}".format(self._relpath) ) self._call_later(self._cancel, snapshot) return if f.check(ResponseNeverReceived): for reason in f.value.reasons: if reason.check(CancelledError): self._factory._folder_status.error_occurred( "Cancelled: {}".format(self._relpath) ) self._call_later(self._cancel, snapshot) return # upon errors, we wait a little and then retry, # putting the item back in the uploader queue self._factory._folder_status.error_occurred( "Error uploading {}: {}".format(self._relpath, f.getErrorMessage()) ) delay_amt = next(retry_delay_sequence) delay = self._delay_later(delay_amt, self._factory._uploader.upload_snapshot, snap) delay.addCallback(got_remote) delay.addErrback(upload_error, snap) return delay
def instance_error(failure): Message.log( message_type="flocker:provision:aws:async_get_node:failed" ) instance.terminate() write_failure(failure) return failure
def cb(result): if isinstance(result, Failure): if isinstance(result.value, CancelledError): if self._deferred is not None: self._deferred.cancel() write_failure(result) self._deferred = None if self.running: self._schedule()
def handle_failure(failure): Message.log( message_type=( u"flocker:provision:libcloud:retry_exception:got_exception" ), ) write_failure(failure) saved_failure[0] = failure return False
def fallback_error(self, request, failure): """ Turn unknown exceptions into 500 errors, and log the failure. """ write_failure(failure) request.setResponseCode(http.INTERNAL_SERVER_ERROR) _application_json(request) return json.dumps({ "reason": "unexpected error processing request" }).encode("utf8")
def failed_query(failure): reasons = getattr(failure.value, 'reasons', None) if reasons is None: # Guess it was something else. Do some simpler logging. write_failure(failure, logger=None) else: # It is one of those. Log all of the stuff from inside it. for reason in reasons: write_failure(reason, logger=None) return False
def log_and_discard(failure): """ Log the supplied failure and discard it. The failure is deliberately discarded so as to prevent any further logging of this failure when the deferred is eventually garbage collected. :param Failure failure: The ``Failure`` to be logged. """ write_failure(failure)
def handle_create_error(failure, name): # XXX This could be dangerous... What about a pre-existing # node with the same name (or even multiple nodes if the name # does not have to be unique)? Message.log( message_type="flocker:provision:libcloud:create_node:failed", node_name=name, ) write_failure(failure) d = self._async_cleanup_node_named(reactor, name) d.addCallback(lambda _: failure) return d
def error(f): write_failure(f) if f.check(CancelledError): self._factory._folder_status.error_occurred( "Cancelled: {}".format(self._relpath) ) self._call_later(self._cancel, snapshot) return self._factory._folder_status.error_occurred( "Error updating personal DMD: {}".format(f.getErrorMessage()) ) with self._action.context(): write_failure(f) delay_amt = next(retry_delay_sequence) delay = self._delay_later(delay_amt, update_personal_dmd) delay.addErrback(error) return None
def error(f): if f.check(CancelledError): self._factory._folder_status.error_occurred( "Cancelled: {}".format(self._relpath) ) self._call_later(self._cancel, snapshot) return self._factory._folder_status.error_occurred( "Failed to download snapshot for '{}'.".format( self._relpath, ) ) with self._action.context(): write_failure(f) delay_amt = next(retry_delay_sequence) delay = self._delay_later(delay_amt, perform_download) delay.addErrback(error) return None
def error(f): # XXX really need to "more visibly" log things like syntax # errors etc... write_failure(f) if f.check(CancelledError): self._factory._folder_status.error_occurred( "Cancelled: {}".format(self._relpath) ) self._call_later(self._cancel, snapshot) return self._factory._folder_status.error_occurred( "Error updating personal DMD: {}".format(f.getErrorMessage()) ) with self._action.context(): write_failure(f) delay_amt = next(retry_delay_sequence) delay = self._delay_later(delay_amt, perform_update) delay.addErrback(error) return None
def handle_request_error(result): self.rate_measurer.request_failed(result) write_failure(result)
def instance_error(failure): Message.log( message_type="flocker:provision:aws:async_get_node:failed") instance.terminate() write_failure(failure) return failure
def update_error_count(failure): self.error_count += 1 failure.printTraceback(sys.stderr) write_failure(failure)
def configure_failed(failure): print "Failed to configure control node" write_failure(failure) return failure
def no_servers(self, request, failure): write_failure(failure) request.setResponseCode(http.INTERNAL_SERVER_ERROR) _application_json(request) return json.dumps({"reason": str(failure.value)}).encode("utf8")
def _failed(self, reason): self._d = None write_failure(reason)