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

Definition at line 232 of file GMPBase.py.

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

Member Function Documentation

def GaudiMP.GMPBase.EventCommunicator.finalize (   self)

Definition at line 287 of file GMPBase.py.

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

Definition at line 287 of file GMPBase.py.

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

Definition at line 267 of file GMPBase.py.

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

Definition at line 267 of file GMPBase.py.

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

Definition at line 253 of file GMPBase.py.

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

Definition at line 253 of file GMPBase.py.

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

Definition at line 303 of file GMPBase.py.

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

Definition at line 303 of file GMPBase.py.

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