本文整理匯總了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)
示例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
示例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)
示例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
)
示例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)
示例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
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)