| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions | Public Attributes | Private Attributes

# GaudiMP::GMPBase::EventCommunicator Class Reference

List of all members.

## Public Member Functions
def | __init__
def | send
def | receive
def | finalize
def | statistics
## Public Attributes
| log
| maxsize
| qin
| qout
| allsent
| allrecv
| nSent
| nRecv
| sizeSent
| sizeRecv
| qinTime
| qoutTime
## Private Attributes
| _gmpc

## Detailed Description

Definition at line 225 of file GMPBase.py.

## Constructor & Destructor Documentation

def GaudiMP::GMPBase::EventCommunicator::__init__ | ( |  | self,
|  |  | GMPComponent,
|  |  | qin,
|  |  | qout
| ) |  |

Definition at line 229 of file GMPBase.py.

    00230                                                   :
    00231         self._gmpc = GMPComponent
    00232         self.log   = self._gmpc.log
    00233         # maximum capacity of Queues
    00234         self.maxsize = 50
    00235         # central variables : Queues
    00236         self.qin  = qin
    00237         self.qout = qout
    00238
    00239         # flags
    00240         self.allsent = False
    00241         self.allrecv = False
    00242
    00243         # statistics storage
    00244         self.nSent    = 0    # counter : items sent
    00245         self.nRecv    = 0    # counter : items received
    00246         self.sizeSent = 0    # measure : size of events sent ( tbuf.Length() )
    00247         self.sizeRecv = 0    # measure : size of events in   ( tbuf.Length() )
    00248         self.qinTime  = 0    # time    : receiving from self.qin
    00249         self.qoutTime = 0    # time    : sending on qout

## Member Function Documentation

def GaudiMP::GMPBase::EventCommunicator::finalize | ( |  | self ) |

Definition at line 284 of file GMPBase.py.

    00285                          :
    00286         self.log.info('Finalize Event Communicator : %s'%(self._gmpc.nodeType))
    00287         # Reader sends one flag for each worker
    00288         # Workers send one flag each
    00289         # Writer sends nothing (it's at the end of the chain)
    00290         if   self._gmpc.nodeType == 'Reader' : downstream = self._gmpc.nWorkers
    00291         elif self._gmpc.nodeType == 'Writer' : downstream = 0
    00292         elif self._gmpc.nodeType == 'Worker' : downstream = 1
    00293         for i in xrange(downstream) :
    00294             self.qout.put( 'FINISHED' )
    00295         if self._gmpc.nodeType != 'Writer' :
    00296             self.qout.join()
    00297         # Now some reporting...
    00298         self.statistics( )

def GaudiMP::GMPBase::EventCommunicator::receive | ( |  | self,
|  |  | timeout = `None`
| ) |  |

Definition at line 264 of file GMPBase.py.

    00265                                       :
    00266         # Receive items from self.qin
    00267         startWait = time.time()
    00268         try :
    00269             itemIn = self.qin.get( timeout=timeout )
    00270         except Empty :
    00271             return None
    00272         self.qinTime += time.time()-startWait
    00273         self.nRecv += 1
    00274         if itemIn.__class__.__name__ == 'tuple' :
    00275             self.sizeRecv += itemIn[1].Length()
    00276         else :
    00277             self.nRecv -= 1
    00278         try :
    00279             self.qin.task_done()
    00280         except :
    00281             self._gmpc.log.warning('TASK_DONE called too often by : %s'\
    00282                                     %(self._gmpc.nodeType))
    00283         return itemIn

def GaudiMP::GMPBase::EventCommunicator::send | ( |  | self,
|  |  | item
| ) |  |

Definition at line 250 of file GMPBase.py.

    00251                            :
    00252         # This class manages the sending of a TBufferFile Event to a Queue
    00253         # The actual item to be sent is a tuple : ( evtNumber, TBufferFile )
    00254         assert item.__class__.__name__ == 'tuple'
    00255         startTransmission = time.time()
    00256         self.qout.put( item )
    00257         # allow the background thread to feed the Queue; not 100% guaranteed to
    00258         # finish before next line
    00259         while self.qout._buffer : time.sleep( NAP )
    00260         self.qoutTime += time.time()-startTransmission
    00261         self.sizeSent += item[1].Length()
    00262         self.nSent += 1
    00263         return SUCCESS

def GaudiMP::GMPBase::EventCommunicator::statistics | ( |  | self ) |

Definition at line 299 of file GMPBase.py.

    00300                            :
    00301         self.log.name = '%s-%i Audit '%(self._gmpc.nodeType,self._gmpc.nodeID)
    00302         self.log.info ( 'Items Sent     : %i'%(self.nSent) )
    00303         self.log.info ( 'Items Received : %i'%(self.nRecv) )
    00304         self.log.info ( 'Data  Sent     : %i'%(self.sizeSent) )
    00305         self.log.info ( 'Data  Received : %i'%(self.sizeRecv) )
    00306         self.log.info ( 'Q-out Time     : %5.2f'%(self.qoutTime) )
    00307         self.log.info ( 'Q-in  Time     : %5.2f'%(self.qinTime ) )
    00308
    00309 # =============================================================================

## Member Data Documentation

GaudiMP::GMPBase::EventCommunicator::_gmpc`[private]`

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::allrecv

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::allsent

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::log

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::maxsize

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::nRecv

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::nSent

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::qin

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::qinTime

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::qout

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::qoutTime

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::sizeRecv

Definition at line 229 of file GMPBase.py.

GaudiMP::GMPBase::EventCommunicator::sizeSent

Definition at line 229 of file GMPBase.py.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiMP/python/GaudiMP/GMPBase.py

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines