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


Initialize the registry.


Retrieve a list of registered actors.

Return type:set

Test whether an actor exists in the registry.

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

Return an ActorProxy for the given UUID.

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

Register a new actor.

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

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


Initialize the Actor object.

Parameters:uuid (str) – Optionally-provided UUID

Return True if this Actor is still alive.

Return type:bool

Wrap this Actor in an ActorProxy object.

Return type:rodario.actors.ActorProxy

Fire up the message handler thread.


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.

_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.

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


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

Return True if the response value is available.

Return type:bool



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

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


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