當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。