rodario

A simple, redis-backed Python actor framework

The Registry

class rodario.registry.Registry[source]

Actor registry class (singleton wrapper)

static __new__()[source]

Retrieve the singleton instance for Registry.

Return type:rodario.registry._Singleton
class rodario.registry._Singleton[source]

Singleton for actor registry

__init__()[source]

Initialize the registry.

actors

Retrieve a list of registered actors.

Return type:set
exists(uuid)[source]

Test whether an actor exists in the registry.

Parameters:uuid (str) – UUID of the actor to check for
Return type:bool
get_proxy(uuid)[source]

Return an ActorProxy for the given UUID.

Parameters:uuid (str) – The UUID to return a proxy object for
Return type:rodario.actors.ActorProxy
register(uuid)[source]

Register a new actor.

Parameters:uuid (str) – The UUID of the actor to register
unregister(uuid)[source]

Unregister an existing actor.

Parameters:uuid (str) – The UUID of the actor to unregister

Actors and Proxies

class rodario.actors.Actor(uuid=None)[source]

Base Actor class

__init__(uuid=None)[source]

Initialize the Actor object.

Parameters:uuid (str) – Optionally-provided UUID
is_alive

Return True if this Actor is still alive.

Return type:bool
proxy()[source]

Wrap this Actor in an ActorProxy object.

Return type:rodario.actors.ActorProxy
start()[source]

Fire up the message handler thread.

stop()[source]

Kill the message handler thread.

class rodario.actors.ActorProxy(actor=None, uuid=None)[source]

Proxy object that fires calls to an actor over redis pubsub

__init__(actor=None, uuid=None)[source]

Initialize instance of ActorProxy.

Accepts either an Actor object to clone or a UUID, but not both.

Parameters:
_proxy(method_name, *args, **kwargs)[source]

Proxy a method call to redis pubsub.

This method is not meant to be called directly. Instead, it is used by the proxy’s self-generated methods to provide the proxy with the same public API as the actor it represents.

Parameters:
  • method_name (str) – The method to proxy
  • args (tuple) – The arguments to pass
  • kwargs (dict) – The keyword arguments to pass
Return type:

multiprocessing.Queue

proxyid = None

This proxy object’s UUID for creating unique channels

class rodario.future.Future(queue)[source]

Custom response type for proxied method calls

get(*args, **kwargs)[source]

Resolve and return the proxied method call’s value.

Return type:mixed
ready

Return True if the response value is available.

Return type:bool

Decorators

rodario.decorators.blocking(func)[source]

Block the thread and return the proxied method call’s result.

Parameters:func (instancemethod) – The function to wrap
Return type:rodario.decorators.BlockingMethod

Exceptions

class rodario.exceptions.InvalidActorException[source]

Raised when a referenced actor does not exist

class rodario.exceptions.InvalidProxyException[source]

Raised when a proxy is not given a valid object to wrap

class rodario.exceptions.UUIDInUseException[source]

Raised during UUID registration if the UUID is already taken

class rodario.exceptions.RegistrationException[source]

Raised when actor registration fails

Indices and tables