| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | Private Attributes | List of all members
GaudiMP.GMPBase.EventCommunicator Class Reference
Inheritance diagram for GaudiMP.GMPBase.EventCommunicator:
[legend]
Collaboration diagram for GaudiMP.GMPBase.EventCommunicator:
[legend]

## 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 228 of file GMPBase.py.

## Constructor & Destructor Documentation

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

Definition at line 232 of file GMPBase.py.

232
233 def __init__( self, GMPComponent, qin, qout ) :
234 self._gmpc = GMPComponent
235 self.log = self._gmpc.log
236 # maximum capacity of Queues
237 self.maxsize = 50
238 # central variables : Queues
239 self.qin = qin
240 self.qout = qout
241
242 # flags
243 self.allsent = False
244 self.allrecv = False
245
246 # statistics storage
247 self.nSent = 0 # counter : items sent
248 self.nRecv = 0 # counter : items received
249 self.sizeSent = 0 # measure : size of events sent ( tbuf.Length() )
250 self.sizeRecv = 0 # measure : size of events in ( tbuf.Length() )
251 self.qinTime = 0 # time : receiving from self.qin
252 self.qoutTime = 0 # time : sending on qout

## Member Function Documentation

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

Definition at line 287 of file GMPBase.py.

287
288 def finalize( self ) :
289 self.log.info('Finalize Event Communicator : %s %s'%(self._gmpc, self._gmpc.nodeType))
290 # Reader sends one flag for each worker
291 # Workers send one flag each
292 # Writer sends nothing (it's at the end of the chain)
293 if self._gmpc.nodeType == 'Reader' : downstream = self._gmpc.nWorkers
294 elif self._gmpc.nodeType == 'Writer' : downstream = 0
295 elif self._gmpc.nodeType == 'Worker' : downstream = 1
296
297 for i in xrange(downstream) :
298 self.qout.put( 'FINISHED' )
299 if self._gmpc.nodeType != 'Writer' :
300 self.qout.join()
301 # Now some reporting...
302 self.statistics( )

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

Definition at line 267 of file GMPBase.py.

267
268 def receive( self, timeout=None ) :
269 # Receive items from self.qin
270 startWait = time.time()
271 try :
272 itemIn = self.qin.get( timeout=timeout )
273 except Empty :
274 return None
275 self.qinTime += time.time()-startWait
276 self.nRecv += 1
277 if itemIn.__class__.__name__ == 'tuple' :
278 self.sizeRecv += itemIn[1].Length()
279 else :
280 self.nRecv -= 1
281 try :
282 self.qin.task_done()
283 except :
284 self._gmpc.log.warning('TASK_DONE called too often by : %s'\
285 %(self._gmpc.nodeType))
286 return itemIn

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

Definition at line 253 of file GMPBase.py.

253
254 def send( self, item ) :
255 # This class manages the sending of a TBufferFile Event to a Queue
256 # The actual item to be sent is a tuple : ( evtNumber, TBufferFile )
257 assert item.__class__.__name__ == 'tuple'
258 startTransmission = time.time()
259 self.qout.put( item )
260 # allow the background thread to feed the Queue; not 100% guaranteed to
261 # finish before next line
262 while self.qout._buffer : time.sleep( NAP )
263 self.qoutTime += time.time()-startTransmission
264 self.sizeSent += item[1].Length()
265 self.nSent += 1
266 return SUCCESS

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

Definition at line 303 of file GMPBase.py.

303
304 def statistics( self ) :
305 self.log.name = '%s-%i Audit '%(self._gmpc.nodeType,self._gmpc.nodeID)
306 self.log.info ( 'Items Sent : %i'%(self.nSent) )
307 self.log.info ( 'Items Received : %i'%(self.nRecv) )
308 self.log.info ( 'Data Sent : %i'%(self.sizeSent) )
309 self.log.info ( 'Data Received : %i'%(self.sizeRecv) )
310 self.log.info ( 'Q-out Time : %5.2f'%(self.qoutTime) )
311 self.log.info ( 'Q-in Time : %5.2f'%(self.qinTime ) )
312
313 # =============================================================================

## Member Data Documentation

GaudiMP.GMPBase.EventCommunicator._gmpc
| private

Definition at line 233 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.allrecv

Definition at line 243 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.allsent

Definition at line 242 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.log

Definition at line 234 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.maxsize

Definition at line 236 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.nRecv

Definition at line 247 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.nSent

Definition at line 246 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qin

Definition at line 238 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qinTime

Definition at line 250 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qout

Definition at line 239 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qoutTime

Definition at line 251 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.sizeRecv

Definition at line 249 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.sizeSent

Definition at line 248 of file GMPBase.py.

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

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