class documentation

class BaseWorker(threading.Thread, object):

View In Hierarchy

Base worker class for worker pools.

Users of a worker pool must override RunTask in a subclass.

Method __init__ Constructor for BaseWorker thread.
Method GetCurrentPriority Returns the priority of the current task.
Method run Main thread function.
Method RunTask Function called to start a task.
Method SetTaskName Sets the name of the current task.
Method ShouldTerminate Returns whether this worker should terminate.
Instance Variable name Undocumented
Instance Variable pool Undocumented
Method _GetCurrentOrderAndTaskId Returns the order and task ID of the current task.
Method _HasRunningTaskUnlocked Returns whether this worker is currently running a task.
Instance Variable _current_task Undocumented
Instance Variable _worker_id Undocumented
def __init__(self, pool, worker_id):

Constructor for BaseWorker thread.

Parameters
poolthe parent worker pool
worker_ididentifier for this worker
def GetCurrentPriority(self):

Returns the priority of the current task.

Should only be called from within RunTask.

def run(self):

Main thread function.

Waits for new tasks to show up in the queue.

def RunTask(self, *args):

Function called to start a task.

This needs to be implemented by child classes.

def SetTaskName(self, taskname):

Sets the name of the current task.

Should only be called from within RunTask.

Parameters
taskname:stringTask's name
def ShouldTerminate(self):

Returns whether this worker should terminate.

Should only be called from within RunTask.

name =

Undocumented

pool =

Undocumented

def _GetCurrentOrderAndTaskId(self):

Returns the order and task ID of the current task.

Should only be called from within RunTask.

def _HasRunningTaskUnlocked(self):

Returns whether this worker is currently running a task.

_current_task =

Undocumented

_worker_id =

Undocumented