Ejemplo n.º 1
0
Archivo: bo.py Proyecto: udeyrishi/bo
def configure_logger():
    root = logging.getLogger()
    root.setLevel(logging.getLevelName(BO_MANAGER_SETTINGS.get('log_level')))
    ch = logging.StreamHandler(sys.stdout)
    formatter = logging.Formatter('%(asctime)s [BO MANAGER] [%(name)s] [%(levelname)s]: %(message)s')
    ch.setFormatter(formatter)
    root.addHandler(ch)
    return root
Ejemplo n.º 2
0
Archivo: bo.py Proyecto: udeyrishi/bo
    def run(self):
        while not self.__sigint_received:
            self.__logger.log(logging.CRITICAL, 'Starting Bo...')
            rc = self.__run_command(BO_LAUNCH_COMMAND)
            if rc == 0:
                if self.__sigint_received:
                    break

                delay = BO_MANAGER_SETTINGS.get('retry_delay_seconds', 10)
                self.__logger.log(logging.CRITICAL, 'Restarting Bo in {0} seconds...'.format(delay))
                sleep(delay)
            else:
                break

        # Cancel the SIGINT call if properly terminated
        self.__final_kill_timer.cancel()
        self.__logger.log(logging.CRITICAL, 'Bo successfully shut down')
Ejemplo n.º 3
0
Archivo: bo.py Proyecto: udeyrishi/bo
def main():
    logger = configure_logger()
    bo_manager = BoManager(logger, BO_MANAGER_SETTINGS.get('force_kill_delay_seconds', 10))
    bo_manager.run()