| The Gaudi Framework v32r1 (f65d50dc)

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

## Constructor & Destructor Documentation

## ◆ __init__()

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

Definition at line 240 of file GMPBase.py.

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

## Member Function Documentation

## ◆ finalize()

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

Definition at line 296 of file GMPBase.py.

296 def finalize(self):
297 self.log.info('Finalize Event Communicator : %s %s' %
298 (self._gmpc, self._gmpc.nodeType))
299 # Reader sends one flag for each worker
300 # Workers send one flag each
301 # Writer sends nothing (it's at the end of the chain)
302 if self._gmpc.nodeType == 'Reader':
303 downstream = self._gmpc.nWorkers
304 elif self._gmpc.nodeType == 'Writer':
305 downstream = 0
306 elif self._gmpc.nodeType == 'Worker':
307 downstream = 1
308
309 for i in xrange(downstream):
310 self.qout.put('FINISHED')
311 if self._gmpc.nodeType != 'Writer':
312 self.qout.join()
313 # Now some reporting...
314 self.statistics()
315
Gaudi::Functional::details::put
Out1 * put(const DataObjectHandle< Out1 > &out_handle, Out2 &&out)
Definition: FunctionalDetails.h:121

## ◆ receive()

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

Definition at line 276 of file GMPBase.py.

276 def receive(self, timeout=None):
277 # Receive items from self.qin
278 startWait = time.time()
279 try:
280 itemIn = self.qin.get(timeout=timeout)
281 except Empty:
282 return None
283 self.qinTime += time.time() - startWait
284 self.nRecv += 1
285 if itemIn.__class__.__name__ == 'tuple':
286 self.sizeRecv += itemIn[1].Length()
287 else:
288 self.nRecv -= 1
289 try:
290 self.qin.task_done()
291 except:
292 self._gmpc.log.warning(
293 'TASK_DONE called too often by : %s' % (self._gmpc.nodeType))
294 return itemIn
295
Gaudi::Functional::details::get
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
Definition: FunctionalDetails.h:332

## ◆ send()

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

Definition at line 261 of file GMPBase.py.

261 def send(self, item):
262 # This class manages the sending of a TBufferFile Event to a Queue
263 # The actual item to be sent is a tuple : ( evtNumber, TBufferFile )
264 assert item.__class__.__name__ == 'tuple'
265 startTransmission = time.time()
266 self.qout.put(item)
267 # allow the background thread to feed the Queue; not 100% guaranteed to
268 # finish before next line
269 while self.qout._buffer:
270 time.sleep(NAP)
271 self.qoutTime += time.time() - startTransmission
272 self.sizeSent += item[1].Length()
273 self.nSent += 1
274 return SUCCESS
275
Gaudi::Functional::details::put
Out1 * put(const DataObjectHandle< Out1 > &out_handle, Out2 &&out)
Definition: FunctionalDetails.h:121

## ◆ statistics()

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

Definition at line 316 of file GMPBase.py.

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

## Member Data Documentation

## ◆ _gmpc

GaudiMP.GMPBase.EventCommunicator._gmpc
| private

Definition at line 241 of file GMPBase.py.

## ◆ allrecv

GaudiMP.GMPBase.EventCommunicator.allrecv

Definition at line 251 of file GMPBase.py.

## ◆ allsent

GaudiMP.GMPBase.EventCommunicator.allsent

Definition at line 250 of file GMPBase.py.

## ◆ log

GaudiMP.GMPBase.EventCommunicator.log

Definition at line 242 of file GMPBase.py.

## ◆ maxsize

GaudiMP.GMPBase.EventCommunicator.maxsize

Definition at line 244 of file GMPBase.py.

## ◆ nRecv

GaudiMP.GMPBase.EventCommunicator.nRecv

Definition at line 255 of file GMPBase.py.

## ◆ nSent

GaudiMP.GMPBase.EventCommunicator.nSent

Definition at line 254 of file GMPBase.py.

## ◆ qin

GaudiMP.GMPBase.EventCommunicator.qin

Definition at line 246 of file GMPBase.py.

## ◆ qinTime

GaudiMP.GMPBase.EventCommunicator.qinTime

Definition at line 258 of file GMPBase.py.

## ◆ qout

GaudiMP.GMPBase.EventCommunicator.qout

Definition at line 247 of file GMPBase.py.

## ◆ qoutTime

GaudiMP.GMPBase.EventCommunicator.qoutTime

Definition at line 259 of file GMPBase.py.

## ◆ sizeRecv

GaudiMP.GMPBase.EventCommunicator.sizeRecv

Definition at line 257 of file GMPBase.py.

## ◆ sizeSent

GaudiMP.GMPBase.EventCommunicator.sizeSent

Definition at line 256 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py