TaskEngine Class Reference

A class for setting up and queueing tasks to a task engine. More...

List of all members.

Public Member Functions

def __init__
def name
 Method for querying the task engine's name.
def spawn
 Method used to queue a task to the task engine.
def run
 The task engine main routine.
def shutdown
 Method for shutting down the task engine.

Private Attributes

 __name
 __queue


Detailed Description

A class for setting up and queueing tasks to a task engine.

A task engine is a thread that polls a task queue and runs tasks found on the queue. Tasks are functions or class methods accompanied with their arguments and keyword arguments. Each task must run to completion before the next task is pulled from the queue. Returning a return value from the task to the caller is currently not supported (easy to add, if the need arises). The queue is a FIFO queue and there is currently no way to jam a task to the head of the queue.

Definition at line 26 of file taskEngine.py.


Member Function Documentation

def __init__   self,
  name = None
 

Definition at line 28 of file taskEngine.py.

def name   self  ) 
 

Method for querying the task engine's name.

Returns:
The task engine's name

Definition at line 36 of file taskEngine.py.

def run   self  ) 
 

The task engine main routine.

This method is invoked by the Thread class and should be considered 'protected'. Do not call it.

Definition at line 54 of file taskEngine.py.

def shutdown   self,
  tmo = 2.0
 

Method for shutting down the task engine.

This method blocks (with a timeout) until the task engine has exited. It makes no sense to spawn this method to the task engine since it waits for the task engine to exit.

Parameters:
tmo The amount of time (seconds) to wait for the task engine to exit
Returns:
0 for success, -1 if the task engine didn't exit, -2 if the task engine exited prematurely

Definition at line 85 of file taskEngine.py.

def spawn   self,
  task,
  args,
  kwargs
 

Method used to queue a task to the task engine.

Parameters:
task The task routine to queue
args The arguments for the task routine
kwargs The keyword arguments for the task routine

Definition at line 43 of file taskEngine.py.


Member Data Documentation

__name [private]
 

Definition at line 33 of file taskEngine.py.

__queue [private]
 

Definition at line 34 of file taskEngine.py.


The documentation for this class was generated from the following file:
Generated on Thu Apr 27 20:53:02 2006 for LICOS L02-01-00 by doxygen 1.4.6-NO