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


Python wsgi.Loader方法代码示例

本文整理汇总了Python中oslo_service.wsgi.Loader方法的典型用法代码示例。如果您正苦于以下问题:Python wsgi.Loader方法的具体用法?Python wsgi.Loader怎么用?Python wsgi.Loader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oslo_service.wsgi的用法示例。


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

示例1: __init__

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def __init__(self, name):
        self._host = CONF.api_listen
        self._port = CONF.api_listen_port

        if platform.system() == "Windows":
            self._workers = 1
        else:
            self._workers = (
                CONF.api_workers or processutils.get_worker_count())

        self._loader = wsgi.Loader(CONF)
        self._app = self._loader.load_app(name)

        self._server = wsgi.Server(CONF,
                                   name,
                                   self._app,
                                   host=self._host,
                                   port=self._port) 
开发者ID:cloudbase,项目名称:vdi-broker,代码行数:20,代码来源:service.py

示例2: __init__

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def __init__(self, name):
        self._host = CONF.api_migration_listen
        self._port = CONF.api_migration_listen_port

        if platform.system() == "Windows":
            self._workers = 1
        else:
            self._workers = (
                CONF.api_migration_workers or processutils.get_worker_count())

        self._loader = wsgi.Loader(CONF)
        self._app = self._loader.load_app(name)

        self._server = wsgi.Server(CONF,
                                   name,
                                   self._app,
                                   host=self._host,
                                   port=self._port) 
开发者ID:cloudbase,项目名称:coriolis,代码行数:20,代码来源:service.py

示例3: initialize_application

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def initialize_application():
    log.register_options(CONF)
    CONF(sys.argv[1:], project="manila", version=version.version_string())
    config.verify_share_protocols()
    log.setup(CONF, "manila")
    rpc.init(CONF)
    return wsgi.Loader(CONF).load_app(name='osapi_share') 
开发者ID:openstack,项目名称:manila,代码行数:9,代码来源:wsgi.py

示例4: setUp

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def setUp(self):
        super(TestWSGIService, self).setUp()
        self.mock_object(wsgi.Loader, 'load_app')
        self.test_service = service.WSGIService("test_service") 
开发者ID:openstack,项目名称:manila,代码行数:6,代码来源:test_service.py

示例5: test_service_random_port

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def test_service_random_port(self):
        self.assertEqual(0, self.test_service.port)
        self.test_service.start()
        self.assertNotEqual(0, self.test_service.port)
        self.test_service.stop()
        wsgi.Loader.load_app.assert_called_once_with("test_service") 
开发者ID:openstack,项目名称:manila,代码行数:8,代码来源:test_service.py

示例6: test_reset_pool_size_to_default

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def test_reset_pool_size_to_default(self):
        self.test_service.start()

        # Stopping the service, which in turn sets pool size to 0
        self.test_service.stop()
        self.assertEqual(0, self.test_service.server._pool.size)

        # Resetting pool size to default
        self.test_service.reset()
        self.test_service.start()
        self.assertGreater(self.test_service.server._pool.size, 0)
        wsgi.Loader.load_app.assert_called_once_with("test_service") 
开发者ID:openstack,项目名称:manila,代码行数:14,代码来源:test_service.py

示例7: __init__

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def __init__(self, name, loader=None):
        """Initialize, but do not start the WSGI server.

        :param name: The name of the WSGI server given to the loader.
        :param loader: Loads the WSGI application using the given name.
        :returns: None

        """
        self.name = name
        self.manager = self._get_manager()
        self.loader = loader or wsgi.Loader(CONF)
        if not rpc.initialized():
            rpc.init(CONF)
        self.app = self.loader.load_app(name)
        self.host = getattr(CONF, '%s_listen' % name, "0.0.0.0")
        self.port = getattr(CONF, '%s_listen_port' % name, 0)
        self.workers = getattr(CONF, '%s_workers' % name, None)
        self.use_ssl = getattr(CONF, '%s_use_ssl' % name, False)
        if self.workers is not None and self.workers < 1:
            LOG.warning(
                "Value of config option %(name)s_workers must be integer "
                "greater than 1.  Input value ignored.", {'name': name})
            # Reset workers to default
            self.workers = None
        self.server = wsgi.Server(
            CONF,
            name,
            self.app,
            host=self.host,
            port=self.port,
            use_ssl=self.use_ssl
        ) 
开发者ID:openstack,项目名称:manila,代码行数:34,代码来源:service.py

示例8: test_relpath_config_not_found

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def test_relpath_config_not_found(self):
        self.config(api_paste_config='api-paste.ini')
        self.assertRaises(
            wsgi.ConfigNotFound,
            wsgi.Loader,
            self.conf
        ) 
开发者ID:openstack,项目名称:oslo.service,代码行数:9,代码来源:test_wsgi.py

示例9: test_asbpath_config_not_found

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def test_asbpath_config_not_found(self):
        self.config(api_paste_config='/etc/openstack-srv/api-paste.ini')
        self.assertRaises(
            wsgi.ConfigNotFound,
            wsgi.Loader,
            self.conf
        ) 
开发者ID:openstack,项目名称:oslo.service,代码行数:9,代码来源:test_wsgi.py

示例10: setUp

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def setUp(self):
        super(TestLoaderNormalFilesystem, self).setUp()
        self.paste_config = tempfile.NamedTemporaryFile(mode="w+t")
        self.paste_config.write(self._paste_config.lstrip())
        self.paste_config.seek(0)
        self.paste_config.flush()

        self.config(api_paste_config=self.paste_config.name)
        self.loader = wsgi.Loader(CONF) 
开发者ID:openstack,项目名称:oslo.service,代码行数:11,代码来源:test_wsgi.py

示例11: __init__

# 需要导入模块: from oslo_service import wsgi [as 别名]
# 或者: from oslo_service.wsgi import Loader [as 别名]
def __init__(self, name, loader=None):
        """Initialize, but do not start the WSGI server.

        :param name: The name of the WSGI server given to the loader.
        :param loader: Loads the WSGI application using the given name.
        :returns: None

        """
        self.name = name
        self.manager = self._get_manager()
        self.loader = loader or wsgi.Loader(CONF)
        self.app = self.loader.load_app(name)
        self.host = getattr(CONF, '%s_listen' % name, "0.0.0.0")
        self.port = getattr(CONF, '%s_listen_port' % name, 0)
        self.workers = (getattr(CONF, '%s_workers' % name, None) or
                        processutils.get_worker_count())
        if self.workers and self.workers < 1:
            worker_name = '%s_workers' % name
            msg = (_("%(worker_name)s value of %(workers)d is invalid, "
                     "must be greater than 0.") %
                   {'worker_name': worker_name,
                    'workers': self.workers})
            raise exception.InvalidInput(msg)

        self.server = wsgi.Server(CONF,
                                  name,
                                  self.app,
                                  host=self.host,
                                  port=self.port)
        super(WSGIService, self).__init__() 
开发者ID:openstack,项目名称:karbor,代码行数:32,代码来源:service.py


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