lsst.ctrl.pool  22.0.1-2-g92698f7+a7cb47fe15
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 420 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.

    @param reducer  Function that does the reducing
    @param initial  Initial value for reduction, or None
    @param sleep  Time to sleep when there's nothing to do (sec)

Definition at line 428 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 470 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 475 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 459 of file pool.py.


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