Package flumotion :: Package worker :: Module worker :: Class Kindergarten
[hide private]

Class Kindergarten

source code

common.log.Loggable --+
                      |
                     Kindergarten

I spawn job processes. I live in the worker brain.

Instance Methods [hide private]
 
__init__(self, options, socketPath, brain) source code
 
play(self, avatarId, type, moduleName, methodName, nice, bundles)
Create a kid and make it "play" by starting a job.
source code
 
setOnShutdown(self, d)
Set a deferred to fire when we have no children
source code
 
getKid(self, avatarId) source code
 
getKids(self) source code
 
getKidAvatarIds(self) source code
 
terminateAll(self) source code
boolean
removeKidByPid(self, pid)
Remove the kid from the kindergarten based on the pid.
source code

Inherited from common.log.Loggable: __providedBy__, debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Class Variables [hide private]
  logCategory = 'workerbrain'
Implementors can provide a category to log their messages under.

Inherited from common.log.Loggable: __implemented__, __provides__

Method Details [hide private]

__init__(self, options, socketPath, brain)
(Constructor)

source code 
Parameters:
  • options (dict) - the optparse option instance of command-line options
  • socketPath (str) - the path of the Unix domain socket for PB
  • brain (WorkerBrain) - a reference to the worker brain

play(self, avatarId, type, moduleName, methodName, nice, bundles)

source code 

Create a kid and make it "play" by starting a job. Starts a component with the given name, of the given type, with the given nice level.

This will spawn a new flumotion-job process.

Parameters:
  • avatarId (str) - avatarId the component should use to log in
  • type (str) - type of component to start
  • 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
  • bundles (list of (str, str)) - ordered list of (bundleName, bundlePath) for this component

removeKidByPid(self, pid)

source code 

Remove the kid from the kindergarten based on the pid. Called by the signal handler in the brain.

Returns: boolean
whether or not a kid with that pid was removed