Package wtf :: Package opi :: Package worker
[hide private]
[frames] | no frames]

Package worker

source code

The modules in this package implement the different ways of worker pool models. Currently there are:

threaded
There's one single process managing a threadpool. Accepted sockets are dispatched to a single worker thread.

Author: André Malo

Submodules [hide private]

Classes [hide private]
  WorkerInterface
Interface for worker implementations
  WorkerPoolInterface
Interface for worker pools
Functions [hide private]
WorkerInterface
factory(config, opts, args)
Create the worker instance selected by configuration
source code
 
register(name, klass)
Register a worker implementation
source code
Variables [hide private]
  __package__ = 'wtf.opi.worker'
Function Details [hide private]

factory(config, opts, args)

source code 
Create the worker instance selected by configuration
Parameters:
  • config (config.Config) - configuration
  • opts (optparse.OptionContainer) - Option container
  • args (list) - Fixed arguments
Returns: WorkerInterface
worker instance

register(name, klass)

source code 
Register a worker implementation
Parameters:
  • name (str) - The name (in the config)
  • klass (WorkerInterface) - The implementation class