Exemplo n.º 1
0
def main():
    """
    The entrypoint for the zoe-master script.
    :return: int
    """
    config.load_configuration()
    args = config.get_conf()
    if args.debug:
        logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)

    else:
        logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)

    logging.getLogger('kazoo').setLevel(logging.WARNING)
    logging.getLogger('requests').setLevel(logging.WARNING)
    logging.getLogger('urllib3').setLevel(logging.WARNING)
    logging.getLogger('docker').setLevel(logging.INFO)
    logging.getLogger("tornado").setLevel(logging.DEBUG)

    log.info("Initializing DB manager")
    config.singletons['sql_manager'] = SQLManager(args)

    log.info("Initializing workspace managers")
    fswk = ZoeFSWorkspace()
    config.singletons['workspace_managers'] = [fswk]

    if config.get_conf().influxdb_enable:
        metrics_th = InfluxDBMetricSender(config.get_conf())
        metrics_th.start()
        config.singletons['metric'] = metrics_th
    else:
        metrics_th = BaseMetricSender('metrics-logger', config.get_conf())
        config.singletons['metric'] = metrics_th

#    stats_th = StatsManager()
#    stats_th.start()  # TODO Broken Docker API
#    config.singletons['stats_manager'] = stats_th

    log.info("Initializing scheduler")
    config.scheduler = ZoeScheduler()

    restart_resubmit_scheduler()

    log.info("Starting ZMQ API server...")
    config.singletons['api_server'] = APIManager()

    try:
        config.singletons['api_server'].loop()
    except KeyboardInterrupt:
        pass
    except Exception:
        log.exception('fatal error')
    finally:
        config.scheduler.quit()
        config.singletons['api_server'].quit()
Exemplo n.º 2
0
def main():
    """
    The entrypoint for the zoe-master script.
    :return: int
    """
    config.load_configuration()
    args = config.get_conf()
    if args.debug:
        logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)

    else:
        logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)

    if config.get_conf().influxdb_enable:
        metrics = InfluxDBMetricSender(config.get_conf().deployment_name, config.get_conf().influxdb_url, config.get_conf().influxdb_dbname)
    else:
        metrics = LogMetricSender(config.get_conf().deployment_name)

    log.info("Initializing DB manager")
    state = SQLManager(args)

    log.info("Initializing scheduler")
    scheduler = ZoeScheduler()

    monitor = ZoeMonitor(state)
    checker = ZoeSwarmChecker(state)

    restart_resubmit_scheduler(state, scheduler)

    log.info("Starting ZMQ API server...")
    api_server = APIManager(metrics, scheduler, state)

    try:
        api_server.loop()
    except KeyboardInterrupt:
        pass
    except Exception:
        log.exception('fatal error')
    finally:
        scheduler.quit()
        monitor.quit()
        checker.quit()
        api_server.quit()
        metrics.quit()
Exemplo n.º 3
0
def main():
    """
    The entrypoint for the zoe-master script.
    :return: int
    """
    config.load_configuration()
    args = config.get_conf()
    if args.debug:
        logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)

    else:
        logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)

    if config.get_conf().influxdb_enable:
        metrics = InfluxDBMetricSender(config.get_conf().deployment_name, config.get_conf().influxdb_url, config.get_conf().influxdb_dbname)
    else:
        metrics = LogMetricSender(config.get_conf().deployment_name)

    log.info("Initializing DB manager")
    state = SQLManager(args)

    log.info("Initializing scheduler")
    scheduler = ZoeScheduler()

    monitor = ZoeMonitor(state)

    restart_resubmit_scheduler(state, scheduler)

    log.info("Starting ZMQ API server...")
    api_server = APIManager(metrics, scheduler, state)

    try:
        api_server.loop()
    except KeyboardInterrupt:
        pass
    except Exception:
        log.exception('fatal error')
    finally:
        scheduler.quit()
        monitor.quit()
        api_server.quit()
        metrics.quit()