The Gaudi Framework  v36r6 (b1ee9983)
GaudiMP.GMPBase.EventCommunicator Class Reference
Inheritance diagram for GaudiMP.GMPBase.EventCommunicator:
Collaboration diagram for GaudiMP.GMPBase.EventCommunicator:

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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 273 of file GMPBase.py.

273  def __init__(self, GMPComponent, qin, qout):
274  self._gmpc = GMPComponent
275  self.log = self._gmpc.log
276  # maximum capacity of Queues
277  self.maxsize = 50
278  # central variables : Queues
279  self.qin = qin
280  self.qout = qout
281 
282  # flags
283  self.allsent = False
284  self.allrecv = False
285 
286  # statistics storage
287  self.nSent = 0 # counter : items sent
288  self.nRecv = 0 # counter : items received
289  self.sizeSent = 0 # measure : size of events sent ( tbuf.Length() )
290  self.sizeRecv = 0 # measure : size of events in ( tbuf.Length() )
291  self.qinTime = 0 # time : receiving from self.qin
292  self.qoutTime = 0 # time : sending on qout
293 

Member Function Documentation

◆ finalize()

def GaudiMP.GMPBase.EventCommunicator.finalize (   self)

Definition at line 330 of file GMPBase.py.

330  def finalize(self):
331  self.log.info(
332  "Finalize Event Communicator : %s %s" % (self._gmpc, self._gmpc.nodeType)
333  )
334  # Reader sends one flag for each worker
335  # Workers send one flag each
336  # Writer sends nothing (it's at the end of the chain)
337  if self._gmpc.nodeType == "Reader":
338  downstream = self._gmpc.nWorkers
339  elif self._gmpc.nodeType == "Writer":
340  downstream = 0
341  elif self._gmpc.nodeType == "Worker":
342  downstream = 1
343 
344  for i in range(downstream):
345  self.qout.put("FINISHED")
346  if self._gmpc.nodeType != "Writer":
347  self.qout.join()
348  # Now some reporting...
349  self.statistics()
350 

◆ receive()

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

Definition at line 309 of file GMPBase.py.

309  def receive(self, timeout=None):
310  # Receive items from self.qin
311  startWait = time.time()
312  try:
313  itemIn = self.qin.get(timeout=timeout)
314  except Empty:
315  return None
316  self.qinTime += time.time() - startWait
317  self.nRecv += 1
318  if itemIn.__class__.__name__ == "tuple":
319  self.sizeRecv += itemIn[1].Length()
320  else:
321  self.nRecv -= 1
322  try:
323  self.qin.task_done()
324  except:
325  self._gmpc.log.warning(
326  "TASK_DONE called too often by : %s" % (self._gmpc.nodeType)
327  )
328  return itemIn
329 

◆ send()

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

Definition at line 294 of file GMPBase.py.

294  def send(self, item):
295  # This class manages the sending of a TBufferFile Event to a Queue
296  # The actual item to be sent is a tuple : ( evtNumber, TBufferFile )
297  assert item.__class__.__name__ == "tuple"
298  startTransmission = time.time()
299  self.qout.put(item)
300  # allow the background thread to feed the Queue; not 100% guaranteed to
301  # finish before next line
302  while self.qout._buffer:
303  time.sleep(NAP)
304  self.qoutTime += time.time() - startTransmission
305  self.sizeSent += item[1].Length()
306  self.nSent += 1
307  return SUCCESS
308 

◆ statistics()

def GaudiMP.GMPBase.EventCommunicator.statistics (   self)

Definition at line 351 of file GMPBase.py.

351  def statistics(self):
352  self.log.name = "%s-%i Audit " % (self._gmpc.nodeType, self._gmpc.nodeID)
353  self.log.info("Items Sent : %i" % (self.nSent))
354  self.log.info("Items Received : %i" % (self.nRecv))
355  self.log.info("Data Sent : %i" % (self.sizeSent))
356  self.log.info("Data Received : %i" % (self.sizeRecv))
357  self.log.info("Q-out Time : %5.2f" % (self.qoutTime))
358  self.log.info("Q-in Time : %5.2f" % (self.qinTime))
359 
360 
361 # =============================================================================
362 
363 

Member Data Documentation

◆ _gmpc

GaudiMP.GMPBase.EventCommunicator._gmpc
private

Definition at line 274 of file GMPBase.py.

◆ allrecv

GaudiMP.GMPBase.EventCommunicator.allrecv

Definition at line 284 of file GMPBase.py.

◆ allsent

GaudiMP.GMPBase.EventCommunicator.allsent

Definition at line 283 of file GMPBase.py.

◆ log

GaudiMP.GMPBase.EventCommunicator.log

Definition at line 275 of file GMPBase.py.

◆ maxsize

GaudiMP.GMPBase.EventCommunicator.maxsize

Definition at line 277 of file GMPBase.py.

◆ nRecv

GaudiMP.GMPBase.EventCommunicator.nRecv

Definition at line 288 of file GMPBase.py.

◆ nSent

GaudiMP.GMPBase.EventCommunicator.nSent

Definition at line 287 of file GMPBase.py.

◆ qin

GaudiMP.GMPBase.EventCommunicator.qin

Definition at line 279 of file GMPBase.py.

◆ qinTime

GaudiMP.GMPBase.EventCommunicator.qinTime

Definition at line 291 of file GMPBase.py.

◆ qout

GaudiMP.GMPBase.EventCommunicator.qout

Definition at line 280 of file GMPBase.py.

◆ qoutTime

GaudiMP.GMPBase.EventCommunicator.qoutTime

Definition at line 292 of file GMPBase.py.

◆ sizeRecv

GaudiMP.GMPBase.EventCommunicator.sizeRecv

Definition at line 290 of file GMPBase.py.

◆ sizeSent

GaudiMP.GMPBase.EventCommunicator.sizeSent

Definition at line 289 of file GMPBase.py.


The documentation for this class was generated from the following file:
Gaudi::Functional::details::get
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
Definition: FunctionalDetails.h:444
Gaudi::Functional::details::put
auto put(const DataObjectHandle< Out1 > &out_handle, Out2 &&out)
Definition: FunctionalDetails.h:173
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:102