| The Gaudi Framework v29r1 (5cd95fa2)

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

## Constructor & Destructor Documentation

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

Definition at line 241 of file GMPBase.py.

241 def __init__(self, GMPComponent, qin, qout):
242 self._gmpc = GMPComponent
243 self.log = self._gmpc.log
244 # maximum capacity of Queues
245 self.maxsize = 50
246 # central variables : Queues
247 self.qin = qin
248 self.qout = qout
249
250 # flags
251 self.allsent = False
252 self.allrecv = False
253
254 # statistics storage
255 self.nSent = 0 # counter : items sent
256 self.nRecv = 0 # counter : items received
257 self.sizeSent = 0 # measure : size of events sent ( tbuf.Length() )
258 self.sizeRecv = 0 # measure : size of events in ( tbuf.Length() )
259 self.qinTime = 0 # time : receiving from self.qin
260 self.qoutTime = 0 # time : sending on qout
261
GaudiMP.GMPBase.EventCommunicator.__init__
def __init__(self, GMPComponent, qin, qout)
Definition: GMPBase.py:241
GaudiMP.GMPBase.EventCommunicator.allrecv
allrecv
Definition: GMPBase.py:252
GaudiMP.GMPBase.EventCommunicator.maxsize
maxsize
Definition: GMPBase.py:245
GaudiMP.GMPBase.EventCommunicator._gmpc
_gmpc
Definition: GMPBase.py:242
GaudiMP.GMPBase.EventCommunicator.allsent
allsent
Definition: GMPBase.py:251
GaudiMP.GMPBase.EventCommunicator.sizeSent
sizeSent
Definition: GMPBase.py:257
GaudiMP.GMPBase.EventCommunicator.nRecv
nRecv
Definition: GMPBase.py:256
GaudiMP.GMPBase.EventCommunicator.qoutTime
qoutTime
Definition: GMPBase.py:260
GaudiMP.GMPBase.EventCommunicator.qinTime
qinTime
Definition: GMPBase.py:259
GaudiMP.GMPBase.EventCommunicator.qin
qin
Definition: GMPBase.py:247
GaudiMP.GMPBase.EventCommunicator.qout
qout
Definition: GMPBase.py:248
GaudiMP.GMPBase.EventCommunicator.nSent
nSent
Definition: GMPBase.py:255
GaudiMP.GMPBase.EventCommunicator.sizeRecv
sizeRecv
Definition: GMPBase.py:258
GaudiMP.GMPBase.EventCommunicator.log
log
Definition: GMPBase.py:243

## Member Function Documentation

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

Definition at line 297 of file GMPBase.py.

297 def finalize(self):
298 self.log.info('Finalize Event Communicator : %s %s' %
299 (self._gmpc, self._gmpc.nodeType))
300 # Reader sends one flag for each worker
301 # Workers send one flag each
302 # Writer sends nothing (it's at the end of the chain)
303 if self._gmpc.nodeType == 'Reader':
304 downstream = self._gmpc.nWorkers
305 elif self._gmpc.nodeType == 'Writer':
306 downstream = 0
307 elif self._gmpc.nodeType == 'Worker':
308 downstream = 1
309
310 for i in xrange(downstream):
311 self.qout.put('FINISHED')
312 if self._gmpc.nodeType != 'Writer':
313 self.qout.join()
314 # Now some reporting...
315 self.statistics()
316
GaudiMP.GMPBase.EventCommunicator._gmpc
_gmpc
Definition: GMPBase.py:242
GaudiMP.GMPBase.EventCommunicator.finalize
def finalize(self)
Definition: GMPBase.py:297
GaudiMP.GMPBase.EventCommunicator.statistics
def statistics(self)
Definition: GMPBase.py:317

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

Definition at line 277 of file GMPBase.py.

277 def receive(self, timeout=None):
278 # Receive items from self.qin
279 startWait = time.time()
280 try:
281 itemIn = self.qin.get(timeout=timeout)
282 except Empty:
283 return None
284 self.qinTime += time.time() - startWait
285 self.nRecv += 1
286 if itemIn.__class__.__name__ == 'tuple':
287 self.sizeRecv += itemIn[1].Length()
288 else:
289 self.nRecv -= 1
290 try:
291 self.qin.task_done()
292 except:
293 self._gmpc.log.warning('TASK_DONE called too often by : %s'
294 % (self._gmpc.nodeType))
295 return itemIn
296
GaudiMP.GMPBase.EventCommunicator.receive
def receive(self, timeout=None)
Definition: GMPBase.py:277
GaudiMP.GMPBase.EventCommunicator.nRecv
nRecv
Definition: GMPBase.py:256
GaudiMP.GMPBase.EventCommunicator.qinTime
qinTime
Definition: GMPBase.py:259
GaudiMP.GMPBase.EventCommunicator.sizeRecv
sizeRecv
Definition: GMPBase.py:258

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

Definition at line 262 of file GMPBase.py.

262 def send(self, item):
263 # This class manages the sending of a TBufferFile Event to a Queue
264 # The actual item to be sent is a tuple : ( evtNumber, TBufferFile )
265 assert item.__class__.__name__ == 'tuple'
266 startTransmission = time.time()
267 self.qout.put(item)
268 # allow the background thread to feed the Queue; not 100% guaranteed to
269 # finish before next line
270 while self.qout._buffer:
271 time.sleep(NAP)
272 self.qoutTime += time.time() - startTransmission
273 self.sizeSent += item[1].Length()
274 self.nSent += 1
275 return SUCCESS
276
GaudiMP.GMPBase.EventCommunicator.sizeSent
sizeSent
Definition: GMPBase.py:257
GaudiMP.GMPBase.EventCommunicator.qoutTime
qoutTime
Definition: GMPBase.py:260
GaudiMP.GMPBase.EventCommunicator.nSent
nSent
Definition: GMPBase.py:255
GaudiMP.GMPBase.EventCommunicator.send
def send(self, item)
Definition: GMPBase.py:262

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

Definition at line 317 of file GMPBase.py.

317 def statistics(self):
318 self.log.name = '%s-%i Audit ' % (self._gmpc.nodeType,
319 self._gmpc.nodeID)
320 self.log.info('Items Sent : %i' % (self.nSent))
321 self.log.info('Items Received : %i' % (self.nRecv))
322 self.log.info('Data Sent : %i' % (self.sizeSent))
323 self.log.info('Data Received : %i' % (self.sizeRecv))
324 self.log.info('Q-out Time : %5.2f' % (self.qoutTime))
325 self.log.info('Q-in Time : %5.2f' % (self.qinTime))
326
327 # =============================================================================
328
329
GaudiMP.GMPBase.EventCommunicator.sizeSent
sizeSent
Definition: GMPBase.py:257
GaudiMP.GMPBase.EventCommunicator.nRecv
nRecv
Definition: GMPBase.py:256
GaudiMP.GMPBase.EventCommunicator.qoutTime
qoutTime
Definition: GMPBase.py:260
GaudiMP.GMPBase.EventCommunicator.qinTime
qinTime
Definition: GMPBase.py:259
GaudiMP.GMPBase.EventCommunicator.nSent
nSent
Definition: GMPBase.py:255
GaudiMP.GMPBase.EventCommunicator.statistics
def statistics(self)
Definition: GMPBase.py:317
GaudiMP.GMPBase.EventCommunicator.sizeRecv
sizeRecv
Definition: GMPBase.py:258

## Member Data Documentation

GaudiMP.GMPBase.EventCommunicator._gmpc
| private

Definition at line 242 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.allrecv

Definition at line 252 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.allsent

Definition at line 251 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.log

Definition at line 243 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.maxsize

Definition at line 245 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.nRecv

Definition at line 256 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.nSent

Definition at line 255 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qin

Definition at line 247 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qinTime

Definition at line 259 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qout

Definition at line 248 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.qoutTime

Definition at line 260 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.sizeRecv

Definition at line 258 of file GMPBase.py.

GaudiMP.GMPBase.EventCommunicator.sizeSent

Definition at line 257 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py