Package flumotion :: Package common :: Module medium :: Class BaseMedium
[hide private]

Class BaseMedium

source code

 twisted.spread.jelly.Jellyable --+            
                                  |            
twisted.spread.flavors.Serializable --+        
                                      |        
   twisted.spread.flavors.Referenceable --+    
                                          |    
                extern.log.log.Loggable --+    
                                          |    
                   twisted.pb.Referenceable --+
                                              |
                                             BaseMedium
Known Subclasses:

I am a base interface for PB clients interfacing with PB server-side avatars. Used by admin/worker/component to talk to manager's vishnu, and by job to talk to worker's brain.

Instance Methods [hide private]
 
setRemoteReference(self, remoteReference)
Set the given remoteReference as the reference to the server-side avatar.
source code
 
hasRemoteReference(self)
Does the medium have a remote reference to a server-side avatar ?
source code
 
callRemoteLogging(self, level, stackDepth, name, *args, **kwargs)
Call the given method with the given arguments remotely on the server-side avatar.
source code
 
callRemote(self, name, *args, **kwargs)
Call the given method with the given arguments remotely on the server-side avatar.
source code
 
getBundledFunction(self, module, function)
Returns the given function in the given module, loading the module from a bundle.
source code
 
runBundledFunction(self, module, function, *args, **kwargs)
Runs the given function in the given module with the given arguments.
source code

Inherited from twisted.pb.Referenceable: remoteMessageReceived

Inherited from twisted.spread.flavors.Referenceable: jellyFor

Inherited from twisted.spread.flavors.Serializable: processUniqueID

Inherited from twisted.spread.jelly.Jellyable: __providedBy__, getStateFor

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]
  logCategory = 'basemedium'
Implementors can provide a category to log their messages under.
str remoteLogName = 'baseavatar'
name to use to log the other side of the connection
flumotion.common.bundleclient.BundleLoader bundleLoader = None
  __implemented__ = <implementedBy flumotion.common.medium.BaseM...
  __provides__ = <zope.interface.declarations.ClassProvides obje...

Inherited from twisted.spread.flavors.Referenceable: perspective

Instance Variables [hide private]
twisted.spread.pb.RemoteReference remote = None
a remote reference to the server-side object on which perspective_(methodName) methods can be called
Method Details [hide private]

setRemoteReference(self, remoteReference)

source code 

Set the given remoteReference as the reference to the server-side avatar.

Parameters:
  • remoteReference - twisted.spread.pb.RemoteReference

callRemoteLogging(self, level, stackDepth, name, *args, **kwargs)

source code 

Call the given method with the given arguments remotely on the server-side avatar.

Gets serialized to server-side perspective_ methods.

Parameters:
  • level (int) - the level we should log at (log.DEBUG, log.INFO, etc)
  • stackDepth (non-positive int) - the number of stack frames to go back to get file and line information, negative or zero.
  • name (str) - name of the remote method

callRemote(self, name, *args, **kwargs)

source code 

Call the given method with the given arguments remotely on the server-side avatar.

Gets serialized to server-side perspective_ methods.

getBundledFunction(self, module, function)

source code 

Returns the given function in the given module, loading the module from a bundle.

If we can't find the bundle for the given module, or if the given module does not contain the requested function, we will raise flumotion.common.errors.RemoteRunError (perhaps a poorly chosen error). If importing the module raises an exception, that exception will be passed through unmodified.

Parameters:
  • module (str) - module the function lives in
  • function (str) - function to run
Returns:
a callable, the given function in the given module.

runBundledFunction(self, module, function, *args, **kwargs)

source code 

Runs the given function in the given module with the given arguments.

This method calls getBundledFunction and then invokes the function. Any error raised by getBundledFunction or by invoking the function will be passed through unmodified.

Callers that expect to return their result over a PB connection should catch nonserializable exceptions so as to prevent nasty backtraces in the logs.

Parameters:
  • module (str) - module the function lives in
  • function (str) - function to run
Returns:
the return value of the given function in the module.

Class Variable Details [hide private]

__implemented__

Value:
<implementedBy flumotion.common.medium.BaseMedium>

__provides__

Value:
<zope.interface.declarations.ClassProvides object at 0x866d14c>