當前位置: 首頁>>代碼示例>>Python>>正文


Python oslo_messaging.RPCClient方法代碼示例

本文整理匯總了Python中oslo_messaging.RPCClient方法的典型用法代碼示例。如果您正苦於以下問題:Python oslo_messaging.RPCClient方法的具體用法?Python oslo_messaging.RPCClient怎麽用?Python oslo_messaging.RPCClient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oslo_messaging的用法示例。


在下文中一共展示了oslo_messaging.RPCClient方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(target, serializer=None, timeout=None):
    assert TRANSPORT is not None
    return messaging.RPCClient(TRANSPORT,
                               target,
                               serializer=serializer,
                               timeout=timeout) 
開發者ID:openstack,項目名稱:zun,代碼行數:8,代碼來源:rpc.py

示例2: __init__

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [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

示例3: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(target, version_cap=None, serializer=None,
               call_monitor_timeout=None):
    if TRANSPORT is None:
        init()

    return messaging.RPCClient(TRANSPORT,
                               target,
                               version_cap=version_cap,
                               serializer=serializer,
                               call_monitor_timeout=call_monitor_timeout) 
開發者ID:openstack,項目名稱:octavia,代碼行數:12,代碼來源:rpc.py

示例4: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(target, version_cap=None, serializer=None):
    if TRANSPORT is None:
        raise AssertionError("'TRANSPORT' must not be None")
    if serializer is None:
        serializer = DesignateObjectSerializer()
    serializer = RequestContextSerializer(serializer)
    return messaging.RPCClient(
        TRANSPORT,
        target,
        version_cap=version_cap,
        serializer=serializer
    ) 
開發者ID:openstack,項目名稱:designate,代碼行數:14,代碼來源:rpc.py

示例5: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(target, serializer=None):
    serializer = RequestContextSerializer(serializer)
    return messaging.RPCClient(_get_transport(), target, serializer=serializer) 
開發者ID:cloudbase,項目名稱:vdi-broker,代碼行數:5,代碼來源:rpc.py

示例6: __init__

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def __init__(self, topic, host):
        try:
            transport = messaging.get_transport(cfg.CONF)
            target = messaging.Target(topic=topic, server=host)
            self.rpc_client = messaging.RPCClient(transport, target)
        except MessagingException as ex:
            raise ex 
開發者ID:WiproOpenSource,項目名稱:galaxia,代碼行數:9,代碼來源:client.py

示例7: __init__

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def __init__(self, transport):
        target = oslo_messaging.Target(topic='test', version='2.0')
        self._client = oslo_messaging.RPCClient(transport, target) 
開發者ID:xgfone,項目名稱:snippet,代碼行數:5,代碼來源:client.py

示例8: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(target, version_cap=None, serializer=None, timeout=None):
    assert TRANSPORT is not None
    if profiler:
        serializer = ProfilerRequestContextSerializer(serializer)
    else:
        serializer = RequestContextSerializer(serializer)

    return messaging.RPCClient(TRANSPORT,
                               target,
                               version_cap=version_cap,
                               serializer=serializer,
                               timeout=timeout) 
開發者ID:openstack,項目名稱:magnum,代碼行數:14,代碼來源:rpc.py

示例9: __init__

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def __init__(self, transport=None, context=None, topic=None, server=None,
                 timeout=None):
        serializer = _init_serializer()
        if transport is None:
            exmods = rpc.get_allowed_exmods()
            transport = messaging.get_rpc_transport(
                CONF, allowed_remote_exmods=exmods)
        self._context = context
        if topic is None:
            topic = ''
        target = messaging.Target(topic=topic, server=server)
        self._client = messaging.RPCClient(transport, target,
                                           serializer=serializer,
                                           timeout=timeout) 
開發者ID:openstack,項目名稱:magnum,代碼行數:16,代碼來源:rpc_service.py

示例10: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(target, version_cap=None, serializer=None):
    assert TRANSPORT is not None
    serializer = RequestContextSerializer(serializer)
    return messaging.RPCClient(TRANSPORT,
                               target,
                               version_cap=version_cap,
                               serializer=serializer) 
開發者ID:openstack,項目名稱:manila,代碼行數:9,代碼來源:rpc.py

示例11: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(target=None, version_cap=None, serializer=None):
    if not CONF.queue.enable:
        return None

    queue_target = target or get_target()
    return messaging.RPCClient(TRANSPORT,
                               target=queue_target,
                               version_cap=version_cap,
                               serializer=serializer) 
開發者ID:cloud-security-research,項目名稱:sgx-kms,代碼行數:11,代碼來源:__init__.py

示例12: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(transport, target, version_cap=None, serializer=None):
    assert transport is not None

    if profiler:
        LOG.info('profiler enabled for RPC client')
        serializer = ProfilerContextSerializer(serializer=serializer)

    return messaging.RPCClient(transport,
                               target,
                               version_cap=version_cap,
                               serializer=serializer) 
開發者ID:openstack,項目名稱:vitrage,代碼行數:13,代碼來源:rpc.py

示例13: get_client

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def get_client(version_cap=None):
    transport = get_transport()
    target = get_target()
    return oslo_messaging.RPCClient(transport, target, version_cap=version_cap) 
開發者ID:openstack,項目名稱:cloudkitty,代碼行數:6,代碼來源:messaging.py

示例14: test_get_api_version

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def test_get_api_version(self):
        with mock.patch.object(om.RPCClient, 'call') as mock_call:
            expected_context = self.context
            self.api.check_api_version(expected_context)
            mock_call.assert_called_once_with(
                expected_context,
                'check_api_version',
                api_version=rpcapi.ApplierAPI().API_VERSION) 
開發者ID:openstack,項目名稱:watcher,代碼行數:10,代碼來源:test_rpcapi.py

示例15: test_execute_audit_without_error

# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import RPCClient [as 別名]
def test_execute_audit_without_error(self):
        with mock.patch.object(om.RPCClient, 'cast') as mock_cast:
            action_plan_uuid = utils.generate_uuid()
            self.api.launch_action_plan(self.context, action_plan_uuid)
            mock_cast.assert_called_once_with(
                self.context,
                'launch_action_plan',
                action_plan_uuid=action_plan_uuid) 
開發者ID:openstack,項目名稱:watcher,代碼行數:10,代碼來源:test_rpcapi.py


注:本文中的oslo_messaging.RPCClient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。