lsst.ctrl.pool  14.0-1-ga2912ff+12
Public Member Functions | List of all members
lsst.ctrl.pool.pool.ReductionThread Class Reference
Inheritance diagram for lsst.ctrl.pool.pool.ReductionThread:

Public Member Functions

def __init__ (self, reducer, initial=None, sleep=0.1)
 Constructor. More...
 
def run (self)
 
def add (self, data)
 
def join (self)
 

Detailed Description

Thread to do reduction of results

"A thread?", you say. "What about the python GIL?"
Well, because we 'sleep' when there's no immediate response from the
slaves, that gives the thread a chance to fire; and threads are easier
to manage (e.g., shared memory) than a process.

Definition at line 418 of file pool.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.ctrl.pool.pool.ReductionThread.__init__ (   self,
  reducer,
  initial = None,
  sleep = 0.1 
)

Constructor.

The 'reducer' should take two values and return a single (reduced) value.

Parameters
reducerFunction that does the reducing
initialInitial value for reduction, or None
sleepTime to sleep when there's nothing to do (sec)

Definition at line 426 of file pool.py.

Member Function Documentation

◆ add()

def lsst.ctrl.pool.pool.ReductionThread.add (   self,
  data 
)
Add data to the queue to be reduced

Definition at line 468 of file pool.py.

◆ join()

def lsst.ctrl.pool.pool.ReductionThread.join (   self)
Complete the thread

Unlike Thread.join (which always returns 'None'), we return the result
we calculated.

Definition at line 473 of file pool.py.

◆ run()

def lsst.ctrl.pool.pool.ReductionThread.run (   self)
Do the work

Thread entry point, called by Thread.start

Definition at line 457 of file pool.py.


The documentation for this class was generated from the following file: