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 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 
def __init__(self, GMPComponent, qin, qout)
Definition: GMPBase.py:231
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 
def __init__(self, GMPComponent, qin, qout)
Definition: GMPBase.py:231

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 
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 
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 
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 
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 
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 
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 
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 

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: