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


Python oslo_messaging.get_rpc_transport方法代码示例

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


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

示例1: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def init(conf):
    global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_rpc_transport(conf,
                                            allowed_remote_exmods=exmods)
    NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
        conf,
        allowed_remote_exmods=exmods)

    if utils.notifications_enabled(conf):
        json_serializer = messaging.JsonPayloadSerializer()
        serializer = RequestContextSerializer(json_serializer)
        NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
                                      serializer=serializer)
    else:
        NOTIFIER = utils.DO_NOTHING 
开发者ID:openstack,项目名称:manila,代码行数:18,代码来源:rpc.py

示例2: get_transport

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def get_transport(url=None, optional=False, cache=True, rpc=False):
    """Initialise the oslo_messaging layer."""
    global TRANSPORTS, DEFAULT_URL
    cache_key = url or DEFAULT_URL + '_rpc' if rpc else ''
    transport = TRANSPORTS.get(cache_key)
    if not transport or not cache:
        try:
            if rpc:
                transport = oslo_msg.get_rpc_transport(CONF, url)
            else:
                transport = oslo_msg.get_notification_transport(CONF, url)
        except oslo_msg.InvalidTransportURL as e:
            if not optional or e.url:
                # NOTE(sileht): oslo_messaging is configured but unloadable
                # so reraise the exception
                raise
            return None
        else:
            if cache:
                TRANSPORTS[cache_key] = transport
    return transport 
开发者ID:openstack,项目名称:vitrage,代码行数:23,代码来源:messaging.py

示例3: get_transport

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def get_transport(url=None, optional=False, cache=True):
    """Initialise the oslo_messaging layer."""
    global TRANSPORTS, DEFAULT_URL
    cache_key = url or DEFAULT_URL
    transport = TRANSPORTS.get(cache_key)
    if not transport or not cache:
        try:
            transport = oslo_messaging.get_rpc_transport(cfg.CONF, url)
        except (oslo_messaging.InvalidTransportURL,
                oslo_messaging.DriverLoadFailure):
            if not optional or url:
                # NOTE(sileht): oslo_messaging is configured but unloadable
                # so reraise the exception
                raise
            return None
        else:
            if cache:
                TRANSPORTS[cache_key] = transport
    return transport 
开发者ID:openstack,项目名称:cloudkitty,代码行数:21,代码来源:messaging.py

示例4: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def init(conf):

    global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_rpc_transport(conf,
                                            allowed_remote_exmods=exmods)
    NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
        conf,
        allowed_remote_exmods=exmods)

    # get_notification_transport has loaded oslo_messaging_notifications config
    # group, so we can now check if notifications are actually enabled.
    if utils.notifications_enabled(conf):
        json_serializer = messaging.JsonPayloadSerializer()
        serializer = RequestContextSerializer(json_serializer)
        NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
                                      serializer=serializer)
    else:
        NOTIFIER = utils.DO_NOTHING 
开发者ID:openstack,项目名称:karbor,代码行数:21,代码来源:rpc.py

示例5: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def init(conf, rpc_ext_mods=None):
    """Initialize the global RPC objects.

    :param conf: The oslo conf to use for initialization.
    :param rpc_ext_mods: Exception modules to expose via RPC.
    :returns: None.
    """
    global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER

    if rpc_ext_mods is None:
        rpc_ext_mods = _DFT_EXMODS
    else:
        rpc_ext_mods = list(set(rpc_ext_mods + _DFT_EXMODS))

    TRANSPORT = oslo_messaging.get_rpc_transport(
        conf, allowed_remote_exmods=rpc_ext_mods)
    NOTIFICATION_TRANSPORT = oslo_messaging.get_notification_transport(
        conf, allowed_remote_exmods=rpc_ext_mods)
    serializer = RequestContextSerializer()
    NOTIFIER = oslo_messaging.Notifier(NOTIFICATION_TRANSPORT,
                                       serializer=serializer) 
开发者ID:openstack,项目名称:neutron-lib,代码行数:23,代码来源:rpc.py

示例6: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def init(conf):
    global TRANSPORT
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_rpc_transport(
        conf, allowed_remote_exmods=exmods) 
开发者ID:openstack,项目名称:zun,代码行数:7,代码来源:rpc.py

示例7: __init__

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def __init__(self, topic, server, endpoints, binary):
        super(Service, self).__init__()
        serializer = _init_serializer()
        transport = messaging.get_rpc_transport(CONF)
        access_policy = dispatcher.DefaultRPCAccessPolicy
        # TODO(asalkeld) add support for version='x.y'
        target = messaging.Target(topic=topic, server=server)
        self.endpoints = endpoints
        self._server = messaging.get_rpc_server(transport, target, endpoints,
                                                executor='eventlet',
                                                serializer=serializer,
                                                access_policy=access_policy)
        self.binary = binary
        profiler.setup(binary, CONF.host) 
开发者ID:openstack,项目名称:zun,代码行数:16,代码来源:rpc_service.py

示例8: __init__

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def __init__(self, amp_id):
        super(AmphoraUpdateController, self).__init__()

        if CONF.api_settings.default_provider_driver == constants.AMPHORAV2:
            topic = constants.TOPIC_AMPHORA_V2
            version = "2.0"
        else:
            topic = cfg.CONF.oslo_messaging.topic
            version = "1.0"
        self.transport = messaging.get_rpc_transport(cfg.CONF)
        self.target = messaging.Target(
            namespace=constants.RPC_NAMESPACE_CONTROLLER_AGENT,
            topic=topic, version=version, fanout=False)
        self.client = messaging.RPCClient(self.transport, target=self.target)
        self.amp_id = amp_id 
开发者ID:openstack,项目名称:octavia,代码行数:17,代码来源:amphora.py

示例9: _fake_create_transport

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def _fake_create_transport(self, url):
        if url not in self._buses:
            self._buses[url] = messaging.get_rpc_transport(
                cfg.CONF,
                url=url)
        return self._buses[url] 
开发者ID:openstack,项目名称:octavia,代码行数:8,代码来源:base.py

示例10: create_transport

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def create_transport(url):
    return messaging.get_rpc_transport(cfg.CONF, url=url) 
开发者ID:openstack,项目名称:octavia,代码行数:4,代码来源:rpc.py

示例11: create_transport

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def create_transport(url):
    exmods = get_allowed_exmods()
    return messaging.get_rpc_transport(CONF,
                                       url=url,
                                       allowed_remote_exmods=exmods) 
开发者ID:openstack,项目名称:designate,代码行数:7,代码来源:rpc.py

示例12: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def init(conf):
    global TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_rpc_transport(conf,
                                            allowed_remote_exmods=exmods)
    serializer = RequestContextSerializer(JsonPayloadSerializer())
    NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer) 
开发者ID:openstack,项目名称:magnum,代码行数:9,代码来源:rpc.py

示例13: __init__

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def __init__(self, topic, server, handlers, binary):
        super(Service, self).__init__()
        serializer = _init_serializer()
        transport = messaging.get_rpc_transport(CONF)
        # TODO(asalkeld) add support for version='x.y'
        access_policy = dispatcher.DefaultRPCAccessPolicy
        target = messaging.Target(topic=topic, server=server)
        self._server = messaging.get_rpc_server(transport, target, handlers,
                                                executor='eventlet',
                                                serializer=serializer,
                                                access_policy=access_policy)
        self.binary = binary
        profiler.setup(binary, CONF.host) 
开发者ID:openstack,项目名称:magnum,代码行数:15,代码来源:rpc_service.py

示例14: get_rpc_transport

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def get_rpc_transport(url=None, optional=False, cache=True):
    return get_transport(url, optional, cache, rpc=True) 
开发者ID:openstack,项目名称:vitrage,代码行数:4,代码来源:messaging.py

示例15: init_action_rpc

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import get_rpc_transport [as 别名]
def init_action_rpc(conf):
    global TRANSPORT
    TRANSPORT = oslo_messaging.get_rpc_transport(conf) 
开发者ID:openstack,项目名称:tacker,代码行数:5,代码来源:rpc.py


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