Esempio n. 1
0
def restart_resubmit_scheduler(state: SQLManager, scheduler: ZoeScheduler):
    """Restart work after a restart of the process."""
    sched_execs = state.execution_list(status=Execution.SCHEDULED_STATUS)
    for e in sched_execs:
        scheduler.incoming(e)

    clean_up_execs = state.execution_list(status=Execution.CLEANING_UP_STATUS)
    for e in clean_up_execs:
        scheduler.terminate(e)

    starting_execs = state.execution_list(status=Execution.STARTING_STATUS)
    for e in starting_execs:
        scheduler.terminate(e)
        scheduler.incoming(e)
def restart_resubmit_scheduler(state: SQLManager, scheduler: ZoeScheduler):
    """Restart work after a restart of the process."""
    sched_execs = state.execution_list(status=Execution.SCHEDULED_STATUS)
    for e in sched_execs:
        scheduler.incoming(e)

    clean_up_execs = state.execution_list(status=Execution.CLEANING_UP_STATUS)
    for e in clean_up_execs:
        scheduler.terminate(e)

    starting_execs = state.execution_list(status=Execution.STARTING_STATUS)
    for e in starting_execs:
        scheduler.terminate(e)
        scheduler.incoming(e)
Esempio 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)

    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()
Esempio n. 4
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()
Esempio n. 5
0
def _digest_application_description(state: SQLManager, execution: Execution):
    for service_descr in execution.description['services']:
        for counter in range(service_descr['total_count']):
            name = "{}{}".format(service_descr['name'], counter)
            state.service_new(execution.id, name, service_descr['name'],
                              service_descr)
def _digest_application_description(state: SQLManager, execution: Execution):
    for service_descr in execution.description['services']:
        for counter in range(service_descr['total_count']):
            name = "{}{}".format(service_descr['name'], counter)
            state.service_new(execution.id, name, service_descr['name'], service_descr)