当前位置: 首页>>代码示例>>Python>>正文


Python service_setup.common_setup函数代码示例

本文整理汇总了Python中st2common.service_setup.common_setup函数的典型用法代码示例。如果您正苦于以下问题:Python common_setup函数的具体用法?Python common_setup怎么用?Python common_setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了common_setup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _setup

def _setup():
    common_setup(service='auth', config=config, setup_db=True, register_mq_exchanges=False,
                 register_signal_handlers=True, register_internal_trigger_types=False,
                 run_migrations=False)

    # Additional pre-run time checks
    validate_auth_backend_is_correctly_configured()
开发者ID:lyandut,项目名称:st2,代码行数:7,代码来源:api.py

示例2: setup_app

def setup_app(config=None):
    LOG.info('Creating st2auth: %s as Pecan app.', VERSION_STRING)

    is_gunicorn = getattr(config, 'is_gunicorn', False)
    if is_gunicorn:
        # This should be called in gunicorn case because we only want
        # workers to connect to db, rabbbitmq etc. In standalone HTTP
        # server case, this setup would have already occurred.
        st2auth_config.register_opts()
        common_setup(service='auth', config=st2auth_config, setup_db=True,
                     register_mq_exchanges=False,
                     register_signal_handlers=True,
                     register_internal_trigger_types=False,
                     run_migrations=False,
                     config_args=config.config_args)

    if not config:
        # standalone HTTP server case
        config = _get_pecan_config()
    else:
        # gunicorn case
        if is_gunicorn:
            config.app = _get_pecan_config().app

    app_conf = dict(config.app)

    app = pecan.make_app(
        app_conf.pop('root'),
        logging=getattr(config, 'logging', {}),
        hooks=[hooks.JSONErrorResponseHook(), hooks.CorsHook()],
        **app_conf
    )
    LOG.info('%s app created.' % __name__)

    return app
开发者ID:AlexeyDeyneko,项目名称:st2,代码行数:35,代码来源:app.py

示例3: _setup

def _setup():
    capabilities = {
        'name': 'notifier',
        'type': 'passive'
    }
    common_setup(service='notifier', config=config, setup_db=True, register_mq_exchanges=True,
                 register_signal_handlers=True, service_registry=True, capabilities=capabilities)
开发者ID:StackStorm,项目名称:st2,代码行数:7,代码来源:st2notifier.py

示例4: _setup

def _setup():
    common_setup(service='auth', config=config, setup_db=True, register_mq_exchanges=False,
                 register_signal_handlers=True, register_internal_trigger_types=False,
                 run_migrations=False)

    if cfg.CONF.auth.mode not in VALID_MODES:
        raise ValueError('Valid modes are: %s' % (','.join(VALID_MODES)))
开发者ID:AlexeyDeyneko,项目名称:st2,代码行数:7,代码来源:api.py

示例5: _setup

def _setup():
    capabilities = {
        'name': 'sensorcontainer',
        'type': 'passive'
    }
    common_setup(service='sensorcontainer', config=config, setup_db=True,
                 register_mq_exchanges=True, register_signal_handlers=True,
                 register_runners=False, service_registry=True, capabilities=capabilities)
开发者ID:nzlosh,项目名称:st2,代码行数:8,代码来源:sensormanager.py

示例6: _setup

def _setup():
    capabilities = {
        'name': 'rulesengine',
        'type': 'passive'
    }
    common_setup(service='rulesengine', config=config, setup_db=True, register_mq_exchanges=True,
                 register_signal_handlers=True, register_internal_trigger_types=True,
                 register_runners=False, service_registry=True, capabilities=capabilities)
开发者ID:nzlosh,项目名称:st2,代码行数:8,代码来源:rulesengine.py

示例7: _setup

def _setup():
    common_setup(
        service='api',
        config=config,
        setup_db=True,
        register_mq_exchanges=True,
        register_signal_handlers=True,
        register_internal_trigger_types=True)
开发者ID:rlugojr,项目名称:st2,代码行数:8,代码来源:api.py

示例8: setup_app

def setup_app(config={}):
    LOG.info('Creating st2api: %s as OpenAPI app.', VERSION_STRING)

    is_gunicorn = config.get('is_gunicorn', False)
    if is_gunicorn:
        # Note: We need to perform monkey patching in the worker. If we do it in
        # the master process (gunicorn_config.py), it breaks tons of things
        # including shutdown
        monkey_patch()

        st2api_config.register_opts()
        capabilities = {
            'name': 'api',
            'listen_host': cfg.CONF.api.host,
            'listen_port': cfg.CONF.api.port,
            'type': 'active'
        }

        # This should be called in gunicorn case because we only want
        # workers to connect to db, rabbbitmq etc. In standalone HTTP
        # server case, this setup would have already occurred.
        common_setup(service='api', config=st2api_config, setup_db=True,
                     register_mq_exchanges=True,
                     register_signal_handlers=True,
                     register_internal_trigger_types=True,
                     run_migrations=True,
                     service_registry=True,
                     capabilities=capabilities,
                     config_args=config.get('config_args', None))

    # Additional pre-run time checks
    validate_rbac_is_correctly_configured()

    router = Router(debug=cfg.CONF.api.debug, auth=cfg.CONF.auth.enable,
                    is_gunicorn=is_gunicorn)

    spec = spec_loader.load_spec('st2common', 'openapi.yaml.j2')
    transforms = {
        '^/api/v1/$': ['/v1'],
        '^/api/v1/': ['/', '/v1/'],
        '^/api/v1/executions': ['/actionexecutions', '/v1/actionexecutions'],
        '^/api/exp/': ['/exp/']
    }
    router.add_spec(spec, transforms=transforms)

    app = router.as_wsgi

    # Order is important. Check middleware for detailed explanation.
    app = StreamingMiddleware(app, path_whitelist=['/v1/executions/*/output*'])
    app = ErrorHandlingMiddleware(app)
    app = CorsMiddleware(app)
    app = LoggingMiddleware(app, router)
    app = ResponseInstrumentationMiddleware(app, router, service_name='api')
    app = RequestIDMiddleware(app)
    app = RequestInstrumentationMiddleware(app, router, service_name='api')

    return app
开发者ID:nzlosh,项目名称:st2,代码行数:57,代码来源:app.py

示例9: setup

def setup():
    common_setup(
        service='workflow_engine',
        config=config,
        setup_db=True,
        register_mq_exchanges=True,
        register_signal_handlers=True
    )

    setup_sigterm_handler()
开发者ID:lyandut,项目名称:st2,代码行数:10,代码来源:workflow_engine.py

示例10: _setup

def _setup():
    capabilities = {
        'name': 'stream',
        'listen_host': cfg.CONF.stream.host,
        'listen_port': cfg.CONF.stream.port,
        'type': 'active'
    }
    common_setup(service='stream', config=config, setup_db=True, register_mq_exchanges=True,
                 register_signal_handlers=True, register_internal_trigger_types=False,
                 run_migrations=False, service_registry=True, capabilities=capabilities)
开发者ID:nzlosh,项目名称:st2,代码行数:10,代码来源:api.py

示例11: setup_app

def setup_app(config=None):
    LOG.info('Creating st2api: %s as Pecan app.', VERSION_STRING)

    is_gunicorn = getattr(config, 'is_gunicorn', False)
    if is_gunicorn:
        # Note: We need to perform monkey patching in the worker. If we do it in
        # the master process (gunicorn_config.py), it breaks tons of things
        # including shutdown
        monkey_patch()

        st2api_config.register_opts()
        # This should be called in gunicorn case because we only want
        # workers to connect to db, rabbbitmq etc. In standalone HTTP
        # server case, this setup would have already occurred.
        common_setup(service='api', config=st2api_config, setup_db=True,
                     register_mq_exchanges=True,
                     register_signal_handlers=True,
                     register_internal_trigger_types=True,
                     run_migrations=True,
                     config_args=config.config_args)

    if not config:
        # standalone HTTP server case
        config = _get_pecan_config()
    else:
        # gunicorn case
        if is_gunicorn:
            config.app = _get_pecan_config().app

    app_conf = dict(config.app)

    active_hooks = [hooks.RequestIDHook(), hooks.JSONErrorResponseHook(),
                    hooks.LoggingHook()]

    if cfg.CONF.auth.enable:
        active_hooks.append(hooks.AuthHook())

    active_hooks.append(hooks.CorsHook())

    app = pecan.make_app(app_conf.pop('root'),
                         logging=getattr(config, 'logging', {}),
                         hooks=active_hooks,
                         **app_conf
                         )

    # Static middleware which servers common static assets such as logos
    static_root = os.path.join(BASE_DIR, 'public')
    app = StaticFileMiddleware(app=app, directory=static_root)

    LOG.info('%s app created.' % __name__)

    return app
开发者ID:Bala96,项目名称:st2,代码行数:52,代码来源:app.py

示例12: _setup

def _setup():
    capabilities = {
        'name': 'auth',
        'listen_host': cfg.CONF.auth.host,
        'listen_port': cfg.CONF.auth.port,
        'listen_ssl': cfg.CONF.auth.use_ssl,
        'type': 'active'
    }
    common_setup(service='auth', config=config, setup_db=True, register_mq_exchanges=False,
                 register_signal_handlers=True, register_internal_trigger_types=False,
                 run_migrations=False, service_registry=True, capabilities=capabilities)

    # Additional pre-run time checks
    validate_auth_backend_is_correctly_configured()
开发者ID:StackStorm,项目名称:st2,代码行数:14,代码来源:api.py

示例13: _setup

def _setup():
    capabilities = {
        'name': 'api',
        'listen_host': cfg.CONF.api.host,
        'listen_port': cfg.CONF.api.port,
        'type': 'active'
    }

    common_setup(service='api', config=config, setup_db=True, register_mq_exchanges=True,
                 register_signal_handlers=True, register_internal_trigger_types=True,
                 service_registry=True, capabilities=capabilities)

    # Additional pre-run time checks
    validate_rbac_is_correctly_configured()
开发者ID:StackStorm,项目名称:st2,代码行数:14,代码来源:api.py

示例14: setup

def setup():
    capabilities = {
        'name': 'workflowengine',
        'type': 'passive'
    }
    common_setup(
        service='workflow_engine',
        config=config,
        setup_db=True,
        register_mq_exchanges=True,
        register_signal_handlers=True,
        service_registry=True,
        capabilities=capabilities
    )

    setup_sigterm_handler()
开发者ID:nzlosh,项目名称:st2,代码行数:16,代码来源:workflow_engine.py

示例15: setup_app

def setup_app(config=None):
    LOG.info("Creating st2api: %s as Pecan app.", VERSION_STRING)

    is_gunicorn = getattr(config, "is_gunicorn", False)
    if is_gunicorn:
        st2api_config.register_opts()
        # This should be called in gunicorn case because we only want
        # workers to connect to db, rabbbitmq etc. In standalone HTTP
        # server case, this setup would have already occurred.
        common_setup(
            service="api",
            config=st2api_config,
            setup_db=True,
            register_mq_exchanges=True,
            register_signal_handlers=True,
            register_internal_trigger_types=True,
            run_migrations=True,
            config_args=config.config_args,
        )

    if not config:
        # standalone HTTP server case
        config = _get_pecan_config()
    else:
        # gunicorn case
        if is_gunicorn:
            config.app = _get_pecan_config().app

    app_conf = dict(config.app)

    active_hooks = [hooks.RequestIDHook(), hooks.JSONErrorResponseHook(), hooks.LoggingHook()]

    if cfg.CONF.auth.enable:
        active_hooks.append(hooks.AuthHook())

    active_hooks.append(hooks.CorsHook())

    app = pecan.make_app(app_conf.pop("root"), logging=getattr(config, "logging", {}), hooks=active_hooks, **app_conf)

    # Static middleware which servers common static assets such as logos
    static_root = os.path.join(BASE_DIR, "public")
    app = StaticFileMiddleware(app=app, directory=static_root)

    LOG.info("%s app created." % __name__)

    return app
开发者ID:amitnavindgi,项目名称:st2,代码行数:46,代码来源:app.py


注:本文中的st2common.service_setup.common_setup函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。