| The Gaudi Framework v28r2-patches (bc4ad17a)

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

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

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__ (self, GMPComponent, qin, qout)
def | send (self, item)
def | receive (self, timeout=None)
def | finalize (self)
def | statistics (self)

## Public Attributes
| log
| maxsize
| qin
| qout
| allsent
| allrecv
| nSent
| nRecv
| sizeSent
| sizeRecv
| qinTime
| qoutTime

## Private Attributes
| _gmpc

## Detailed Description

Definition at line 227 of file GMPBase.py.

## Constructor & Destructor Documentation

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

Definition at line 231 of file GMPBase.py.

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

## Member Function Documentation

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

Definition at line 286 of file GMPBase.py.

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

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

Definition at line 266 of file GMPBase.py.

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

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

Definition at line 252 of file GMPBase.py.

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

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

Definition at line 302 of file GMPBase.py.

302 def statistics( self ) :
303 self.log.name = '%s-%i Audit '%(self._gmpc.nodeType,self._gmpc.nodeID)
304 self.log.info ( 'Items Sent : %i'%(self.nSent) )
305 self.log.info ( 'Items Received : %i'%(self.nRecv) )
306 self.log.info ( 'Data Sent : %i'%(self.sizeSent) )
307 self.log.info ( 'Data Received : %i'%(self.sizeRecv) )
308 self.log.info ( 'Q-out Time : %5.2f'%(self.qoutTime) )
309 self.log.info ( 'Q-in Time : %5.2f'%(self.qinTime ) )
310
311 # =============================================================================
312
GaudiMP.GMPBase.EventCommunicator.sizeSent
sizeSent
Definition: GMPBase.py:247
GaudiMP.GMPBase.EventCommunicator.nRecv
nRecv
Definition: GMPBase.py:246
GaudiMP.GMPBase.EventCommunicator.qoutTime
qoutTime
Definition: GMPBase.py:250
GaudiMP.GMPBase.EventCommunicator.qinTime
qinTime
Definition: GMPBase.py:249
GaudiMP.GMPBase.EventCommunicator.nSent
nSent
Definition: GMPBase.py:245
GaudiMP.GMPBase.EventCommunicator.statistics
def statistics(self)
Definition: GMPBase.py:302
GaudiMP.GMPBase.EventCommunicator.sizeRecv
sizeRecv
Definition: GMPBase.py:248

## Member Data Documentation

GaudiMP.GMPBase.EventCommunicator._gmpc
| private

Definition at line 232 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.allrecv

Definition at line 242 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.allsent

Definition at line 241 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.log

Definition at line 233 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.maxsize

Definition at line 235 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.nRecv

Definition at line 246 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.nSent

Definition at line 245 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qin

Definition at line 237 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qinTime

Definition at line 249 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qout

Definition at line 238 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qoutTime

Definition at line 250 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.sizeRecv

Definition at line 248 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.sizeSent

Definition at line 247 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py