tacker.common.rpc module

class tacker.common.rpc.BackingOffClient(transport, target, timeout=None, version_cap=None, serializer=None, retry=None, call_monitor_timeout=None, transport_options=None, _manual_load=True)

Bases: RPCClient

An oslo messaging RPC Client that implements a timeout backoff.

This has all of the same interfaces as oslo_messaging.RPCClient but if the timeout parameter is not specified, the _ContextWrapper returned will track when call timeout exceptions occur and exponentially increase the timeout for the given call method.

prepare(*args, **kwargs)

Prepare a method invocation context.

Use this method to override client properties for an individual method invocation. For example:

def test(self, ctxt, arg):
    cctxt = self.prepare(version='2.5')
    return cctxt.call(ctxt, 'test', arg=arg)
Parameters:
  • exchange (str) – see Target.exchange

  • topic (str) – see Target.topic

  • namespace (str) – see Target.namespace

  • version (str) – requirement the server must support, see Target.version

  • server (str) – send to a specific server, see Target.server

  • fanout (bool) – send to all servers on topic, see Target.fanout

  • timeout (int or float) – an optional default timeout (in seconds) for call()s

  • version_cap (str) – raise a RPCVersionCapError version exceeds this cap

  • retry (int) – an optional connection retries configuration: None or -1 means to retry forever. 0 means no retry is attempted. N means attempt at most N retries.

  • transport_options (dictionary) – additional parameters to configure the driver for example to send parameters as “mandatory” flag in RabbitMQ

  • call_monitor_timeout (int) – an optional timeout (in seconds) for active call heartbeating. If specified, requires the server to heartbeat long-running calls at this interval (less than the overall timeout parameter).

static set_max_timeout(max_timeout)

Set RPC timeout ceiling for all backing-off RPC clients.

class tacker.common.rpc.Connection

Bases: object

close()
consume_in_threads()
create_consumer(topic, endpoints, fanout=False, exchange='tacker', host=None, serializer=None)
class tacker.common.rpc.RequestContextSerializer(base=None)

Bases: Serializer

convert RPC common context int tacker Context.

deserialize_context(ctxt)

Deserialize a dictionary into a request context.

Parameters:

ctxt – Request context dictionary

Returns:

Deserialized form of entity

deserialize_entity(ctxt, entity)

Deserialize something from primitive form.

Parameters:
  • ctxt – Request context, in deserialized form

  • entity – Primitive to be deserialized

Returns:

Deserialized form of entity

serialize_context(ctxt)

Serialize a request context into a dictionary.

Parameters:

ctxt – Request context

Returns:

Serialized form of context

serialize_entity(ctxt, entity)

Serialize something to primitive form.

Parameters:
  • ctxt – Request context, in deserialized form

  • entity – Entity to be serialized

Returns:

Serialized form of entity

class tacker.common.rpc.Service(host, topic, manager=None, serializer=None)

Bases: Service

Service object for binaries running on hosts.

A service enables rpc by listening to queues based on topic and host.

start()

Start a service.

stop()

Stop a service.

Parameters:

graceful – indicates whether to wait for all threads to finish or terminate them instantly

class tacker.common.rpc.VoidConnection

Bases: object

close()
consume_in_threads()
create_consumer(topic, endpoints, fanout=False, exchange='tacker', host=None)
tacker.common.rpc.add_extra_exmods(*args)
tacker.common.rpc.cleanup()
tacker.common.rpc.clear_extra_exmods()
tacker.common.rpc.create_connection()
tacker.common.rpc.get_allowed_exmods()
tacker.common.rpc.get_client(target, version_cap=None, serializer=None)
tacker.common.rpc.get_notifier(service=None, host=None, publisher_id=None)
tacker.common.rpc.get_server(target, endpoints, serializer=None)
tacker.common.rpc.init(conf)
tacker.common.rpc.init_action_rpc(conf)