def __terminateDiagnoseMode(self, report, status):
     msg = ""
     msg += status.nick.upper()
     fatal = 0
     if report.fatalError:
         fatal += 1
     total = len(report.errors)
     for t in report.targets.values():
         if not t:
             continue
         if t.fatalError:
             fatal += 1
         total += len(t.errors)
     if fatal > 0:
         msg += " ** %d Fatal Error(s)" % fatal
     if total > fatal:
         msg += " ** %d Recoverable Error(s)" % (total - fatal)
     self.info('*'*6 + " " + msg + " " + '*'*6)
     utils.callNext(reactor.stop)
예제 #2
0
 def __asyncStartTask(self):
     available = self._transcoding.getAvailableSlots()
     if available <= 0:
         self._startDelay = None
         return
     profCtx, params = self.__popNextProfile()
     if not profCtx:
         self._startDelay = None
         return
     self.__startTranscodingTask(profCtx, params=params)
     self._startDelay = utils.callNext(self.__asyncStartTask)
예제 #3
0
def main(args):
    log.setDefaultCategory(adminconsts.ADMIN_LOG_CATEGORY)
    log.setDebugNotifier(notifier.notifyDebug)

    options, configPath = parse_options(args)

    loader = inifile.IniFile()
    config = adminconfig.ClusterConfig()
    try:
        loader.loadFromFile(config, configPath)
    except Exception, e:
        sys.stderr.write('Error: %s\n' % e)
        sys.exit(1)

    debug = options.debug or config.debug
    if debug:
        log.setFluDebug(debug)

    if options.daemonize:
        possess(options.daemonizeTo)

    a = admin.TranscoderAdmin(config)
    utils.callNext(a.initialize)
    reactor.run()

    if options.daemonize:
        exorcize()

    log.info('Stopping transcoder-admin')
 def __ebDiagnoseAcknowledgeFail(self, failure):
     log.notifyFailure(self, failure,
                       "Acknowledgment failed",
                       cleanTraceback=True)
     utils.callNext(reactor.stop)
예제 #5
0
 def __startupTasks(self):
     if self.isStarted() and not self._startDelay:
         self._startDelay = utils.callNext(self.__asyncStartTask)
예제 #6
0
 def _setJobState(self, state):
     #FIXME: Don't reference the global context
     reporter = self._context.reporter
     reporter.report.state = state
     # The state is changed after the current processing chain terminate.
     utils.callNext(self._fireJobStateChanged, state)
예제 #7
0
        self._ackList.addErrback(self.__ebFatalFailure,
                                 context, "output files moving")
        if self._moveInputFile:
            #Setup input file moving
            self._ackList.addBoth(self.__bbMoveInputFile, context)
        #Handle termination
        self._ackList.addBoth(self.__bbJobTerminated, context)

        self._fireJobInfo(context)
        self._fireSourceInfo(sourceCtx)
        for targetCtx in context.getTargetContexts():
            self._fireTargetInfo(targetCtx)
            self._setTargetState(targetCtx, TargetStateEnum.pending)

        #start to work after the starting call chain terminate
        utils.callNext(d.callback, None)
        self._runningState = RunningState.running
        return d

    def stop(self):
        self._context.info("Stopping transcoding job")
        self._setJobState(JobStateEnum.stopping)
        self._stopping = True
        # If already tell to stop, do nothing
        if self._stoppingDefer:
            return self._stoppingDefer
        # If the job has been acknowledged, wait until completion
        if self._runningState == RunningState.acknowledged:
            self._stoppingDefer = defer.Deferred()
            self._ackList.addBoth(self._stoppingDefer.callback)
        else: