common.worker (version 0.1, 14 April 2003)
index
e:\bothans\common\worker.py

WorkerMonoThreadedWorker and MultiThreadedWorker. Allow you to
pass a function along and let it be executed by the worker (whatever his type
is, multi or mono)

 
Modules
            
Queue
logging
thread
 
Classes
            
threading.Thread(threading._Verbose)
_DThread
Worker
MonoThreadedWorker
MultiThreadedWorker
 
class MonoThreadedWorker(Worker)
      Worker with just one thread
 
   Methods defined here:
__init__(self)
start(self)

Data and non-method functions defined here:
__doc__ = 'Worker with just one thread'
__module__ = 'common.worker'

Methods inherited from Worker:
execFunction(self, func, *args)
stop(self)
 Method to end gracefully the worker

Data and non-method functions inherited from Worker:
STOP_MESSAGE = 44567
WORKER_QUEUE_SIZE = 200
 
class MultiThreadedWorker(Worker)
      Worker with multiple threads
 
   Methods defined here:
__init__(self, howmany=10)
start(self)
stop(self)

Data and non-method functions defined here:
MULTITHREAD_WORKER_NTHREADS = 10
__doc__ = 'Worker with multiple threads'
__module__ = 'common.worker'

Methods inherited from Worker:
execFunction(self, func, *args)

Data and non-method functions inherited from Worker:
STOP_MESSAGE = 44567
WORKER_QUEUE_SIZE = 200
 
class Worker
      Basic Unity of Workers. This works like this: this class contains a
queue; when you want to pass a function to execute to the worker, you
call execFunction(function, arguments ...) and it puts a tuple (function,
arguments) on the queue. Upper classes have mono or multiple threads
whose run() function is to 1) get the next element on this queue, 2)
execute its content, 3) goto 1 ;) See {Mono,Multi}ThreadedWorker for more
 
see common/testworker.py for examples.
 
Note: You should *not* use this class directly
 
   Methods defined here:
__init__(self)
execFunction(self, func, *args)
stop(self)
 Method to end gracefully the worker

Data and non-method functions defined here:
STOP_MESSAGE = 44567
WORKER_QUEUE_SIZE = 200
__doc__ = 'Basic Unity of Workers. This works like this: th... Note: You should *not* use this class directly'
__module__ = 'common.worker'
 
class _DThread(threading.Thread)
      Worker thread. It spies on queue and executes. It loops while
it doesn't receive a STOP_MESSAGE on the queue
 
  
Method resolution order:
_DThread
threading.Thread
threading._Verbose

Methods defined here:
__init__(self, queue)
run(self)

Data and non-method functions defined here:
__doc__ = "A Worker thread. It spies on queue and executes.... it doesn't receive a STOP_MESSAGE on the queue"
__module__ = 'common.worker'

Methods inherited from threading.Thread:
_Thread__bootstrap = __bootstrap(self)
_Thread__delete = __delete(self)
_Thread__stop = __stop(self)
__repr__(self)
_set_daemon(self)
getName(self)
isAlive(self)
isDaemon(self)
join(self, timeout=None)
setDaemon(self, daemonic)
setName(self, name)
start(self)

Data and non-method functions inherited from threading.Thread:
_Thread__initialized = 0

Methods inherited from threading._Verbose:
_note(self, format, *args)
 
Data
             __all__ = ['MultiThreadedWorker', 'MonoThreadedWorker']
__author__ = 'David Ferlier <david@netbsd-fr.org>'
__date__ = '14 April 2003'
__file__ = r'e:\bothans\common\worker.pyc'
__license__ = 'This file is part of Bothans\n\n Bothans is fre...lace, Suite 330, Boston, MA 02111-1307 USA\n '
__name__ = 'common.worker'
__status__ = 'beta'
__version__ = '0.1'
 
Author
             David Ferlier <david@netbsd-fr.org>