Beispiel #1
0
def setup_app(config=None):
    if not config:
        config = get_pecan_config()

    q_config.set_config_defaults()

    app_conf = dict(config.app)

    db_api.setup_db()

    if cfg.CONF.api.enable_job_handler:
        LOG.info('Starting periodic tasks...')
        periodics.start_job_handler()

    app = pecan.make_app(
        app_conf.pop('root'),
        hooks=lambda: [ctx.ContextHook(), ctx.AuthHook()],
        logging=getattr(config, 'logging', {}),
        **app_conf)

    # Set up access control.
    app = access_control.setup(app)

    # Create HTTPProxyToWSGI wrapper
    app = http_proxy_to_wsgi_middleware.HTTPProxyToWSGI(app, cfg.CONF)

    # Create a CORS wrapper, and attach mistral-specific defaults that must be
    # included in all CORS responses.
    return cors_middleware.CORS(app, cfg.CONF)
Beispiel #2
0
    def heavy_init(cls):
        """Runs a long initialization.

        This method runs long initialization once by class
        and can be extended by child classes.
        """
        cfg.CONF.set_default('connection', 'sqlite://', group='database')
        cfg.CONF.set_default('max_overflow', -1, group='database')
        cfg.CONF.set_default('max_pool_size', 1000, group='database')

        qinling_opts = [
            (config.API_GROUP, config.api_opts),
            (config.PECAN_GROUP, config.pecan_opts),
            (config.ENGINE_GROUP, config.engine_opts),
            (config.STORAGE_GROUP, config.storage_opts),
            (config.KUBERNETES_GROUP, config.kubernetes_opts),
            (config.ETCD_GROUP, config.etcd_opts),
            (config.RLIMITS_GROUP, config.rlimits_opts),
            (None, [config.launch_opt]),
            (None, config.default_opts)
        ]
        for group, options in qinling_opts:
            cfg.CONF.register_opts(list(options), group)
        cls.qinling_endpoint = 'http://127.0.0.1:7070/'
        cfg.CONF.set_default('qinling_endpoint', cls.qinling_endpoint)

        db_api.setup_db()
Beispiel #3
0
    def start(self):
        orchestrator = orchestra_base.load_orchestrator(CONF)

        db_api.setup_db()

        LOG.info('Starting periodic tasks...')
        periodics.start_function_mapping_handler(orchestrator)

        topic = CONF.engine.topic
        server = CONF.engine.host
        transport = messaging.get_transport(CONF)
        target = messaging.Target(topic=topic, server=server, fanout=False)
        endpoints = [engine.DefaultEngine(orchestrator)]
        access_policy = dispatcher.DefaultRPCAccessPolicy
        self.server = messaging.get_rpc_server(
            transport,
            target,
            endpoints,
            executor='eventlet',
            access_policy=access_policy,
            serializer=rpc.ContextSerializer(
                messaging.serializer.JsonPayloadSerializer()))

        LOG.info('Starting engine...')
        self.server.start()

        super(EngineService, self).start()
Beispiel #4
0
    def heavy_init(cls):
        """Runs a long initialization.

        This method runs long initialization once by class
        and can be extended by child classes.
        """
        cfg.CONF.set_default('connection', 'sqlite://', group='database')
        cfg.CONF.set_default('max_overflow', -1, group='database')
        cfg.CONF.set_default('max_pool_size', 1000, group='database')

        db_api.setup_db()
Beispiel #5
0
def setup_app(config=None):
    if not config:
        config = get_pecan_config()

    app_conf = dict(config.app)
    db_api.setup_db()

    app = pecan.make_app(
        app_conf.pop('root'),
        hooks=lambda: [ctx.ContextHook(), ctx.AuthHook()],
        logging=getattr(config, 'logging', {}),
        **app_conf)

    # Set up access control.
    app = access_control.setup(app)

    return app
Beispiel #6
0
def setup_app(config=None):
    if not config:
        config = get_pecan_config()
    app_conf = dict(config.app)

    db_api.setup_db()

    LOG.info('Starting periodic tasks...')
    periodics.start_job_handler()

    app = pecan.make_app(
        app_conf.pop('root'),
        hooks=lambda: [ctx.ContextHook(), ctx.AuthHook()],
        logging=getattr(config, 'logging', {}),
        **app_conf)

    # Set up access control.
    app = access_control.setup(app)

    return app
Beispiel #7
0
    def start(self):
        orchestrator = orchestra_base.load_orchestrator(CONF)

        topic = CONF.engine.topic
        server = CONF.engine.host
        transport = messaging.get_transport(CONF)
        target = messaging.Target(topic=topic, server=server, fanout=False)
        endpoints = [engine.DefaultEngine(orchestrator)]
        self.server = messaging.get_rpc_server(
            transport,
            target,
            endpoints,
            executor='eventlet',
            serializer=rpc.ContextSerializer(
                messaging.serializer.JsonPayloadSerializer()))

        db_api.setup_db()

        LOG.info('Starting engine...')
        self.server.start()

        super(EngineService, self).start()
Beispiel #8
0
    def run(self):
        qinling_endpoint = keystone_utils.get_qinling_endpoint()
        orchestrator = orchestra_base.load_orchestrator(CONF, qinling_endpoint)
        db_api.setup_db()

        topic = CONF.engine.topic
        server = CONF.engine.host
        transport = messaging.get_rpc_transport(CONF)
        target = messaging.Target(topic=topic, server=server, fanout=False)
        endpoint = engine.DefaultEngine(orchestrator, qinling_endpoint)
        access_policy = dispatcher.DefaultRPCAccessPolicy
        self.server = messaging.get_rpc_server(
            transport,
            target, [endpoint],
            executor='threading',
            access_policy=access_policy,
            serializer=rpc.ContextSerializer(
                messaging.serializer.JsonPayloadSerializer()))

        LOG.info('Starting function mapping periodic task...')
        periodics.start_function_mapping_handler(endpoint)

        LOG.info('Starting engine...')
        self.server.start()