def __cbMultiDeleteResults(self, results, newResult): for succeed, result in results: if not succeed: log.notifyFailure(self, result, "Failure waiting admin task '%s' " "components beeing deleted", self.label) return newResult
def __bbTaskTerminated(self, resultOrFailure, result): if isinstance(resultOrFailure, Failure): log.notifyFailure(self, resultOrFailure, "Failure terminating admin task '%s'", self.label) self._doTerminated(result) else: self._doTerminated(resultOrFailure)
def __ebPauseFailed(self, failure): log.notifyFailure(self, failure, "Task Manager '%s' failed to pause", self.label) if self._state == TaskStateEnum.pausing: self._state = TaskStateEnum.started self._pauseWaiters.fireErrbacks(failure) else: self.__stateChangedError(self._pauseWaiters, "pausing")
def __ebGetPropertiesFailed(self, failure, compPxy): msg = ("Task manager '%s' fail to retrieve component '%s' properties." % (self.label, compPxy.getName())) log.notifyFailure(self, failure, "%s", msg) self.__apartTasklessComponent(compPxy) self._pending -= 1 self._tryStartup() raise admerrs.ComponentRejectedError(msg, cause=failure)
def __ebUIStateFailed(self, failure, compPxy, workerName): if not failure.check(ConnectionLost, PBConnectionLost): # Do not notify failure because of component crash log.notifyFailure(self, failure, "Admin task '%s' failed to retrieve " "component '%s' UI state", self.label, compPxy.getName()) self.__abortComponentStartup(compPxy)
def __ebComponentLoadFailed(self, failure, componentName, workerName): if not failure.check("twisted.spread.pb.PBConnectionLost", "twisted.spread.pb.DeadReferenceError"): log.notifyFailure(self, failure, "Admin task '%s' fail to load " "component '%s' on worker '%s'", self.label, componentName, workerName) self.__abortComponentStartup()
def _unexpectedError(self, failure): """ Prevents the lost of failure messages. Can be use by all child classes when adding a callback that is not expected to fail. """ log.notifyFailure(self, failure, "Unexpected Failure") #Resolve the failure. return
def __ebProfileInitFailed(self, failure, profStore): #FIXME: Better Error Handling ? log.notifyFailure(self, failure, "Profile '%s' of customer '%s' failed " "to initialize; dropping it", profStore.label, self.label) profStore._abort(failure) # Don't propagate failures, will be dropped anyway return
def _monitorError(self, failure=None, task=None): if not failure: failure = Failure() log.notifyFailure(self, failure, "Monitoring error%s", (task and " during %s" % task) or "", cleanTraceback=True) self.setMood(moods.sad) return failure
def __ebTargetInitFailed(self, failure, targStore): #FIXME: Better Error Handling ? log.notifyFailure(self, failure, "Target '%s' of profile '%s' failed " "to initialize; dropping it", targStore.label, self.label) targStore._abort(failure) # Don't propagate failures, will be dropped anyway return
def __ebReportRetrievalFailed(self, failure, transcod_successful): if transcod_successful: msg = "successful" else: msg = "failed" log.notifyFailure(self, failure, "Failure during retrieving a %s transcoding report" % msg) # Not being able to retrieve the report doesn't mean that the # transcoding itself failed. Continue with the callback chain. return None
def __bbSelectPotentialComponent(self, resultOrFailure): if isinstance(resultOrFailure, Failure): log.notifyFailure(self, resultOrFailure, "Failure in admin task '%s' during potential " "component selection", self.label) compPxys = [] else: compPxys = resultOrFailure return self._doSelectPotentialComponent(compPxys)
def __ebAcknowledgeFailed(self, failure, transPxy): if not self._isElectedComponent(transPxy): return if not failure.check("twisted.spread.pb.PBConnectionLost", "flumotion.common.errors.SleepingComponentError"): log.notifyFailure( self, failure, "Failed to acknowledge task '%s' transcoder '%s'", self.label, transPxy.getName() ) # If the acknowledge fail, the state is unpredictable, # so there is no sense to abort and retry. self.__transcodingFailed(transPxy)
def _retrievalFailed(self, failure): """ Can be used by child class as retrieval errorback. """ #FIXME: Better Error Handling ? log.notifyFailure(self, failure, "Data retrieval failed for %s '%s'", self.__class__.__name__, self.label) #Propagate failures return failure
def __ebComponentRestorationFailed(self, failure, compPxy): if not self.__checkHeldComponentStatus(compPxy): return log.notifyFailure(self, failure, "Failure during task '%s' restoration of held " "component '%s'", self.label, compPxy.getName()) self._cancelComponentHold() self._abort() self._stopComponent(compPxy)
def __cbMultiUIStateResults(self, results): newResult = [] for succeed, result in results: if succeed: if result != None: newResult.append(result) elif not result.check("twisted.internet.error.ConnectionDone"): log.notifyFailure(self, result, "Failure waiting admin task '%s' " "components UI State", self.label) return newResult
def __cbStartResumeTranscoding(self, result): if isinstance(result, Failure) and not result.check(iherrors.TimeoutError): log.notifyFailure(self, result, "Failure waiting transcoder set " "to become idle") self.log("Free to continue transcoding startup/resuming") d = defer.Deferred() for task in self.iterTasks(): d.addCallback(self.__cbAddBalancedTask, task) d.addCallback(defer.dropResult, self._balancer.balance) d.addErrback(self.__ebStartupResumingFailure) d.callback(None) return d
def __ebStartupFailed(self, failure, actionDesc): log.notifyFailure(self, failure, "Admin task '%s' failed to startup/resume", self.label) if self._state == TaskStateEnum.starting: self._state = TaskStateEnum.stopped self._startWaiters.fireErrbacks(failure) elif self._state == TaskStateEnum.resuming: self._state = TaskStateEnum.paused self._startWaiters.fireErrbacks(failure) else: self.__stateChangedError(self._startWaiters, actionDesc)
def __transcodingError(self, failure=None, task=None): self._fireStatusChanged(TranscoderStatusEnum.error) if not failure: failure = Failure() self.onJobError(failure.getErrorMessage()) log.notifyFailure(self, failure, "Transocding error%s", (task and " during %s" % task) or "", cleanTraceback=True) self.setMood(moods.sad) return failure
def _unexpected_error(self, failure=None, task=None): if not failure: failure = Failure() log.notifyFailure(self, failure, "Unexpected error%s", (task and " during %s" % task) or "", cleanTraceback=True) m = messages.Error(_(failure.getErrorMessage()), debug=log.getFailureMessage(failure)) self.addMessage(m) return failure
def __move_files_failed(self, failure, monitor_proxy, src_base, dest_base, relFiles): try: failure.trap(PBConnectionLost, DeadReferenceError) except: log.notifyFailure(self, failure, "Monitoring task '%s' monitor " "'%s' fail to move files from '%s' to '%s'", self.label, monitor_proxy.getName(), src_base, dest_base) # Continue moving files anyway self.__async_move_pending_files()
def __unexpectedError(self, failure=None, task=None): self._fireStatusChanged(TranscoderStatusEnum.unexpected_error) if not failure: failure = Failure() self.onJobError(failure.getErrorMessage()) log.notifyFailure(self, failure, "Unexpected error%s", (task and " during %s" % task) or "", cleanTraceback=True) m = messages.Error(T_(failure.getErrorMessage()), debug=log.getFailureMessage(failure)) self.addMessage(m) return failure
def __ebRecoverableFailure(self, failure, context, task, result=None): # If stopping don't do anything if self._isStopping(): return context = self.__lookupContext(context, failure) if context.reporter.hasFatalError(): context.debug("Skipping %s because of fatal error during %s" % (task, context.reporter.report.state.name)) return failure context.reporter.addError(failure) warMsg = failure.getErrorMessage() log.notifyFailure(context, failure, "Recoverable error during %s", task) self._fireWarning(context, warMsg) # The error is resolved return result
def __ebFatalFailure(self, failure, context, task): # If stopping don't do anything if self._isStopping(): return context = self.__lookupContext(context, failure) if context.reporter.hasFatalError(): context.debug("Skipping %s because of fatal error during %s" % (task, context.reporter.report.state.name)) return failure context.reporter.addError(failure) errMsg = failure.getErrorMessage() context.reporter.setFatalError(errMsg) log.notifyFailure(context, failure, "Fatal error during %s", task) self._fireError(context, errMsg) if not failure.check(FlumotionError): raise TranscoderError(errMsg, data=context, cause=failure) return failure
def __ebFilesStateUpdateFailed(self, failure): self._stateUpdateResult = None log.notifyFailure(self, failure, "Failed to update file states") self.__updateFilesState()
def fallback_mime_and_checksum_none(self, failure): log.notifyFailure(self, failure, "Failure during checksum / mime type") return (None, None)
def __ebAcceptFailure(self, failure, compPxy, message): log.notifyFailure(self, failure, "%s", message)
def __ebDiagnoseAcknowledgeFail(self, failure): log.notifyFailure(self, failure, "Acknowledgment failed", cleanTraceback=True) utils.callNext(reactor.stop)
def __ebFailureDiagnosticFailed(self, failure, report, task, transPxy): log.notifyFailure(self, failure, "Failure during transcoding failure diagnostic") # But we continue like if nothing has append self.__notifyTranscodingfailure(None, report, task, transPxy)
def __ebTaskStopFailed(self, failure, task): log.notifyFailure(self, failure, "Task Manager '%s' failed to stop task '%s'", self.label, task.label)