Package flumotion :: Package worker :: Module medium :: Class WorkerMedium
[hide private]

Class WorkerMedium

source code

 twisted.spread.jelly.Jellyable --+                    
                                  |                    
twisted.spread.flavors.Serializable --+                
                                      |                
   twisted.spread.flavors.Referenceable --+            
                                          |            
                extern.log.log.Loggable --+            
                                          |            
                   twisted.pb.Referenceable --+        
                                              |        
                       common.medium.BaseMedium --+    
                                                  |    
                        common.medium.PingingMedium --+
                                                      |
                                                     WorkerMedium

I am a medium interfacing with the manager-side WorkerAvatar.

Instance Methods [hide private]
 
__init__(self, brain) source code
 
startConnecting(self, connectionInfo) source code
 
stopConnecting(self) source code
2-tuple: (list of int, bool)
remote_getPorts(self)
Gets the set of TCP ports that this worker is configured to use.
source code
int, or NoneType
remote_getFeedServerPort(self)
Return the TCP port the Feed Server is listening on.
source code
 
remote_create(self, avatarId, type, moduleName, methodName, nice, conf)
Start a component of the given type with the given nice level.
source code
list of str
remote_checkElements(self, elementNames)
Checks if one or more GStreamer elements are present and can be instantiated.
source code
 
remote_checkImport(self, moduleName)
Checks if the given module can be imported.
source code
 
remote_runCheck(self, module, function, *args, **kwargs)
Runs the given function in the given module with the given arguments.
source code
 
remote_runFunction(self, module, function, *args, **kwargs)
Runs the given function in the given module with the given arguments.
source code
 
remote_getComponents(self)
I return a list of componentAvatarIds, I have.
source code
 
remote_killJob(self, avatarId, signum=9)
Kill one of the worker's jobs.
source code
 
remote_getVersions(self) source code
deferred that will fire an object implementing IDirectory
remote_listDirectory(self, directoryName)
List the directory called path
source code

Inherited from common.medium.PingingMedium: remote_writeFluDebugMarker, setRemoteReference, startPinging, stopPinging

Inherited from common.medium.BaseMedium: callRemote, callRemoteLogging, getBundledFunction, hasRemoteReference, runBundledFunction

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 = 'workermedium'
Implementors can provide a category to log their messages under.
  __implemented__ = <implementedBy flumotion.worker.medium.Worke...
  __provides__ = <zope.interface.declarations.ClassProvides obje...

Inherited from common.medium.BaseMedium: bundleLoader, remoteLogName

Inherited from twisted.spread.flavors.Referenceable: perspective

Instance Variables [hide private]
worker.WorkerBrain brain
the worker brain
WorkerClientFactory factory
the worker client factory

Inherited from common.medium.BaseMedium: remote

Method Details [hide private]

__init__(self, brain)
(Constructor)

source code 
Parameters:

remote_getPorts(self)

source code 

Gets the set of TCP ports that this worker is configured to use.

Returns: 2-tuple: (list of int, bool)
list of ports, and a boolean if we allocate ports randomly

remote_getFeedServerPort(self)

source code 

Return the TCP port the Feed Server is listening on.

Returns: int, or NoneType
TCP port number, or None if there is no feed server

remote_create(self, avatarId, type, moduleName, methodName, nice, conf)

source code 

Start a component of the given type with the given nice level. Will spawn a new job process to run the component in.

Parameters:
  • avatarId (str) - avatar identification string
  • type (str) - type of the component to create
  • moduleName (str) - name of the module to create the component from
  • methodName (str) - the factory method to use to create the component
  • nice (int) - nice level
  • conf (dict) - component config
Returns:
a deferred fired when the process has started and created the component

remote_checkElements(self, elementNames)

source code 

Checks if one or more GStreamer elements are present and can be instantiated.

Parameters:
  • elementNames (list of str) - names of the Gstreamer elements
Returns: list of str
a list of instantiatable element names

remote_checkImport(self, moduleName)

source code 

Checks if the given module can be imported.

Parameters:
  • moduleName (str) - name of the module to check
Returns:
None or Failure

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

source code 

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

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

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

source code 

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

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

remote_getComponents(self)

source code 

I return a list of componentAvatarIds, I have. I am called by the manager soon after I attach to it. This is needed on reconnects so that the manager knows what components it needs to start on me.

Returns:
a list of componentAvatarIds

remote_killJob(self, avatarId, signum=9)

source code 

Kill one of the worker's jobs.

This method is intended for exceptional purposes only; a normal component shutdown is performed by the manager via calling remote_stop() on the component avatar.

Raises flumotion.common.errors.UnknownComponentError if the job is unknown.

Parameters:
  • avatarId (string) - the avatar Id of the component, e.g. '/default/audio-encoder'
  • signum (int) - Signal to send, optional. Defaults to SIGKILL.

remote_listDirectory(self, directoryName)

source code 

List the directory called path

Returns: deferred that will fire an object implementing IDirectory
the directory

Class Variable Details [hide private]

__implemented__

Value:
<implementedBy flumotion.worker.medium.WorkerMedium>

__provides__

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