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