コード例 #1
0
def main():

    cli_args = cli_config.parse_cli()

    config = {
        "server": {"host": cli_args.host, "port": cli_args.port},
        "dbpath": cli_args.dbpath,
        "debug": cli_args.debug,
        "debug_tests": cli_args.debug_tests,
    }

    logger.setup(log_file=cli_args.log_file)

    log = logging.getLogger(__name__)

    root = app.setup_app(config=config)

    if getattr(cli_args, "after_init_hook"):
        return nailgun_hooks.after_initialization_environment_hook()
    nose_discovery.discovery(cli_args.debug_tests)
    host, port = pecan.conf.server.host, pecan.conf.server.port
    srv = pywsgi.WSGIServer((host, int(port)), root)

    log.info("Starting server in PID %s", os.getpid())
    log.info("serving on http://%s:%s", host, port)

    try:
        signal.signal(signal.SIGCHLD, signal.SIG_IGN)
        srv.serve_forever()
    except KeyboardInterrupt:
        pass
コード例 #2
0
ファイル: adapter_api.py プロジェクト: Mellanox/fuel-ostf
def main():

    settings = Ostf_Config()

    cli_args = cli_config.parse_cli()

    config = {
        'server': {
            'host': settings.adapter.server_host or cli_args.host,
            'port': settings.adapter.server_port or cli_args.port
        },
        'dbpath': settings.adapter.dbpath or cli_args.dbpath,
        'debug': cli_args.debug,
        'debug_tests': cli_args.debug_tests,
        'lock_dir': settings.adapter.lock_dir or cli_args.lock_dir,
        'nailgun': {
            'host': settings.adapter.nailgun_host or cli_args.nailgun_host,
            'port': settings.adapter.nailgun_port or cli_args.nailgun_port
        }
    }
    logger.setup(log_file=(
        settings.adapter.log_file or cli_args.log_file))

    log = logging.getLogger(__name__)

    root = app.setup_app(config=config)

    if settings.adapter.after_init_hook or\
            getattr(cli_args, 'after_init_hook'):
        return nailgun_hooks.after_initialization_environment_hook()

    with engine.contexted_session(pecan.conf.dbpath) as session:
        # performing cleaning of expired data (if any) in db
        mixins.clean_db(session)

        # discover testsets and their tests
        CORE_PATH = pecan.conf.debug_tests if \
            pecan.conf.get('debug_tests') else 'fuel_health'

        nose_discovery.discovery(path=CORE_PATH, session=session)

        # cache needed data from test repository
        mixins.cache_test_repository(session)

    host, port = pecan.conf.server.host, pecan.conf.server.port
    srv = pywsgi.WSGIServer((host, int(port)), root)

    log.info('Starting server in PID %s', os.getpid())
    log.info("serving on http://%s:%s", host, port)

    try:
        signal.signal(signal.SIGCHLD, signal.SIG_IGN)
        srv.serve_forever()
    except KeyboardInterrupt:
        pass
コード例 #3
0
def main():

    cli_args = cli_config.parse_cli()

    config = {
        'server': {
            'host': cli_args.host,
            'port': cli_args.port
        },
        'dbpath': cli_args.dbpath,
        'debug': cli_args.debug,
        'debug_tests': cli_args.debug_tests,
        'nailgun': {
            'host': cli_args.nailgun_host,
            'port': cli_args.nailgun_port
        }
    }

    logger.setup(log_file=cli_args.log_file)

    log = logging.getLogger(__name__)

    root = app.setup_app(config=config)

    if getattr(cli_args, 'after_init_hook'):
        return nailgun_hooks.after_initialization_environment_hook()

    #performing cleaning of expired data (if any) in db
    clean_db()

    #discover testsets and their tests
    CORE_PATH = pecan.conf.debug_tests if \
        pecan.conf.get('debug_tests') else 'fuel_health'

    discovery(path=CORE_PATH, session=engine.get_session())

    #cache needed data from test repository
    cache_data()

    host, port = pecan.conf.server.host, pecan.conf.server.port
    srv = pywsgi.WSGIServer((host, int(port)), root)

    log.info('Starting server in PID %s', os.getpid())
    log.info("serving on http://%s:%s", host, port)

    try:
        signal.signal(signal.SIGCHLD, signal.SIG_IGN)
        srv.serve_forever()
    except KeyboardInterrupt:
        pass
コード例 #4
0
ファイル: server.py プロジェクト: pradiprawat/fuel-ostf
def main():

    ostf_config.init_config(sys.argv[1:])

    logger.setup(log_file=CONF.adapter.log_file)

    log = logging.getLogger(__name__)
    log.info('Start app configuration')

    root = app.setup_app({})

    # completely clean db (drop tables, constraints and types)
    # plus drop alembic_version table (needed if, for example, head migration
    # script was changed after applying)
    if CONF.clear_db:
        return nailgun_hooks.clear_db(CONF.adapter.dbpath)

    if CONF.after_initialization_environment_hook:
        return nailgun_hooks.after_initialization_environment_hook()

    with engine.contexted_session(CONF.adapter.dbpath) as session:
        # performing cleaning of expired data (if any) in db
        mixins.delete_db_data(session)
        log.info('Cleaned up database.')
        # discover testsets and their tests
        CORE_PATH = CONF.debug_tests or 'fuel_health'

        log.info('Performing nose discovery with {0}.'.format(CORE_PATH))

        nose_discovery.discovery(path=CORE_PATH, session=session)

        # cache needed data from test repository
        mixins.cache_test_repository(session)

    log.info('Discovery is completed')
    host, port = CONF.adapter.server_host, CONF.adapter.server_port
    srv = pywsgi.WSGIServer((host, port), root)

    log.info('Starting server in PID %s', os.getpid())
    log.info("serving on http://%s:%s", host, port)

    try:
        signal.signal(signal.SIGCHLD, signal.SIG_IGN)
        srv.serve_forever()
    except KeyboardInterrupt:
        pass
コード例 #5
0
ファイル: server.py プロジェクト: EkaterinaShutova/fuel-ostf
def main():

    ostf_config.init_config(sys.argv[1:])

    logger.setup(log_file=CONF.adapter.log_file)

    log = logging.getLogger(__name__)
    log.info('Start app configuration')

    root = app.setup_app({})

    # completely clean db (drop tables, constraints and types)
    # plus drop alembic_version table (needed if, for example, head migration
    # script was changed after applying)
    if CONF.clear_db:
        return nailgun_hooks.clear_db(CONF.adapter.dbpath)

    if CONF.after_initialization_environment_hook:
        return nailgun_hooks.after_initialization_environment_hook()

    with engine.contexted_session(CONF.adapter.dbpath) as session:
        # performing cleaning of expired data (if any) in db
        mixins.delete_db_data(session)
        log.info('Cleaned up database.')
        # discover testsets and their tests
        CORE_PATH = CONF.debug_tests or 'fuel_health'

        log.info('Performing nose discovery with {0}.'.format(CORE_PATH))

        nose_discovery.discovery(path=CORE_PATH, session=session)

        # cache needed data from test repository
        mixins.cache_test_repository(session)

    log.info('Discovery is completed')
    host, port = CONF.adapter.server_host, CONF.adapter.server_port
    srv = pywsgi.WSGIServer((host, port), root)

    log.info('Starting server in PID %s', os.getpid())
    log.info("serving on http://%s:%s", host, port)

    try:
        signal.signal(signal.SIGCHLD, signal.SIG_IGN)
        srv.serve_forever()
    except KeyboardInterrupt:
        pass
コード例 #6
0
def main():

    cli_args = cli_config.parse_cli()

    config = {
        'server': {
            'host': cli_args.host,
            'port': cli_args.port
        },
        'dbpath': cli_args.dbpath,
        'debug': cli_args.debug,
        'debug_tests': cli_args.debug_tests,
        'nailgun': {
            'host': cli_args.nailgun_host,
            'port': cli_args.nailgun_port
        }
    }

    logger.setup(log_file=cli_args.log_file)

    log = logging.getLogger(__name__)

    root = app.setup_app(config=config)

    if getattr(cli_args, 'after_init_hook'):
        return nailgun_hooks.after_initialization_environment_hook()
    host, port = pecan.conf.server.host, pecan.conf.server.port
    srv = pywsgi.WSGIServer((host, int(port)), root)

    log.info('Starting server in PID %s', os.getpid())
    log.info("serving on http://%s:%s", host, port)

    try:
        signal.signal(signal.SIGCHLD, signal.SIG_IGN)
        srv.serve_forever()
    except KeyboardInterrupt:
        pass