rtCommon.remoteable

A set of classes that can be subclassed or extended to allow for automatically forwarding methods calls on the subclass to a remote RPC handler.

On cloud side we will have a remoteInstance (with remoteCall stub) that calls the networking crossbar to send the request to the remote. On the remote side we will have a RemoteHandler instance and when messages are received will dispatch them to the handler.

Module Contents

Classes

Remoteable

A class that can be subclassed to allow remote invocation.

RemoteStub

A remote stub class where none of the attributes of the original class are defined.

RemoteableExtensible

A class that can be subclassed to allow remote invocation. The remote and local versions

RemoteHandler

Class that runs at the remote and as message requests are received they are dispatched

Attributes

defaultRpcTimeout

rtCommon.remoteable.defaultRpcTimeout = 60
class rtCommon.remoteable.Remoteable(isRemote=False)

Bases: object

A class that can be subclassed to allow remote invocation. When isRemote is True it returns a remote stub instance, when false it returns the real instance

class rtCommon.remoteable.RemoteStub(classType, isRemote=True)

Bases: object

A remote stub class where none of the attributes of the original class are defined. Therefore __getattr__ will be called for all attributes (i.e. intercepting normal calls) and this class overrides __getattr__ to forward the call request to a remote instance via the registered communication channel function.

setRPCTimeout(timeout)
registerCommFunction(commFunction)
remoteCall(attribute, *args, **kwargs) any
__getattr__(name)
class rtCommon.remoteable.RemoteableExtensible(isRemote=False)

Bases: object

A class that can be subclassed to allow remote invocation. The remote and local versions are the same class type (not a stub) and in the remote instance case attributes can be registerd as ‘local’ meaning calls to them will be handled local, all other calls would be sent to the remote instance.

isRunningRemote()
setRPCTimeout(timeout)
registerCommFunction(commFunction)
remoteCall(attribute, *args, **kwargs) any
addLocalAttributes(methods)
__getattribute__(name)

Return getattr(self, name).

class rtCommon.remoteable.RemoteHandler

Class that runs at the remote and as message requests are received they are dispatched to this class for processing.

registerClassInstance(classType, classInstance)
registerClassNameInstance(className, classInstance)
runRemoteCall(callDict)