예제 #1
0
    def tick(self):
        Log("New bibsched cycle", self.debug)
        self.cycles_count += 1

        self.check_debug_mode()

        if self.cycles_count % 50 == 0:
            self.check_for_crashed_tasks()

        try:
            self.check_errors()
        except RecoverableError, msg:
            register_emergency('Light emergency from %s: BibTask failed: %s'
                                                         % (CFG_SITE_URL, msg))
예제 #2
0
    def watch_loop(self):
        ## Cleaning up scheduled task not run because of bibsched being
        ## interrupted in the middle.
        run_sql("""UPDATE schTASK
                   SET status = 'WAITING'
                   WHERE status = 'SCHEDULED'
                   AND host = %s""", (self.hostname, ))

        try:
            while True:
                auto_mode = self.check_auto_mode()
                if auto_mode:
                    self.tick()
                else:
                    time.sleep(CFG_BIBSCHED_REFRESHTIME)
        except Exception, err:
            register_exception(alert_admin=True)
            try:
                register_emergency('Emergency from %s: BibSched halted: %s'
                                                         % (CFG_SITE_URL, err))
            except NotImplementedError:
                pass
            raise