Package flumotion :: Package service :: Module service :: Class Servicer
[hide private]

Class Servicer

source code

extern.log.log.Loggable --+
                          |
                         Servicer

I manage running managers and workers on behalf of a service script.

Instance Methods [hide private]
 
__init__(self, configDir=None, logDir=None, runDir=None) source code
 
_parseManagersWorkers(self, command, args) source code
 
_getDirOptions(self)
Return a list of override directories for configure.configure suitable for appending to a command line.
source code
 
getManagers(self)
Returns: a dictionary of manager names -> flow names
source code
 
getWorkers(self)
Returns: a list of worker names
source code
 
start(self, args)
Start processes as given in the args.
source code
 
stop(self, args)
Stop processes as given in the args.
source code
 
status(self, args)
Give status on processes as given in the args.
source code
 
clean(self, args)
Clean up dead process pid files as given in the args.
source code
 
condrestart(self, args)
Restart running processes as given in the args.
source code
 
create(self, args)
Create a default manager or worker config.
source code
 
createManager(self, name, port=7531)
Create a sample manager.
source code
 
createWorker(self, name, managerPort=7531, randomFeederports=False)
Create a sample worker.
source code
 
startManager(self, name, flowNames)
Start the manager as configured in the manager directory for the given manager name, together with the given flows.
source code
 
startWorker(self, name)
Start the worker as configured in the worker directory for the given worker name.
source code
 
startProcess(self, command)
Start the given process and block.
source code
 
stopManager(self, name)
Stop the given manager if it is running.
source code
 
stopWorker(self, name)
Stop the given worker if it is running.
source code
 
stopProcess(self, pid)
Stop the process with the given pid.
source code
 
list(self)
List all service parts managed.
source code

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

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

Inherited from extern.log.log.Loggable: __implemented__, __provides__

Method Details [hide private]

__init__(self, configDir=None, logDir=None, runDir=None)
(Constructor)

source code 
Parameters:
  • configDir (string) - overridden path to the configuration directory.
  • logDir (string) - overridden path to the log directory.
  • runDir (string) - overridden path to the run directory.

getManagers(self)

source code 
Returns:
a dictionary of manager names -> flow names

getWorkers(self)

source code 
Returns:
a list of worker names

start(self, args)

source code 

Start processes as given in the args.

If nothing specified, start all managers and workers. If first argument is "manager", start given manager. If first argument is "worker", start given worker.

Returns:
an exit value reflecting the number of processes that failed to start

stop(self, args)

source code 

Stop processes as given in the args.

If nothing specified, stop all managers and workers. If first argument is "manager", stop given manager. If first argument is "worker", stop given worker.

Returns:
an exit value reflecting the number of processes that failed to stop

condrestart(self, args)

source code 

Restart running processes as given in the args.

If nothing specified, condrestart all managers and workers. If first argument is "manager", condrestart given manager. If first argument is "worker", condrestart given worker.

Returns:
an exit value reflecting the number of processes that failed to start

createManager(self, name, port=7531)

source code 

Create a sample manager.

Returns:
whether or not the config was created.

createWorker(self, name, managerPort=7531, randomFeederports=False)

source code 

Create a sample worker.

Returns:
whether or not the config was created.

startManager(self, name, flowNames)

source code 

Start the manager as configured in the manager directory for the given manager name, together with the given flows.

Returns:
whether or not the manager daemon started

startWorker(self, name)

source code 

Start the worker as configured in the worker directory for the given worker name.

Returns:
whether or not the worker daemon started

startProcess(self, command)

source code 

Start the given process and block. Returns the exit status of the process, or -1 in case of another error.

stopProcess(self, pid)

source code 

Stop the process with the given pid. Wait until the pid has disappeared.