GaudiMP.GMPBase.Subworker Class Reference
Inheritance diagram for GaudiMP.GMPBase.Subworker:
Collaboration diagram for GaudiMP.GMPBase.Subworker:

Public Member Functions

def __init__ (self, workerID, queues, events, params, subworkers)
 
def Engine (self)
 
def SetServices (self, a, evt, hvt, fsr, inc, pers, ts, cntr)
 
def getCheckAlgs (self)
 
def checkExecutedPassed (self, algName)
 
def isEventPassed (self)
 
def __init__ (self, workerID, queues, events, params, subworkers)
 
def Engine (self)
 
def SetServices (self, a, evt, hvt, fsr, inc, pers, ts, cntr)
 
def getCheckAlgs (self)
 
def checkExecutedPassed (self, algName)
 
def isEventPassed (self)
 
- Public Member Functions inherited from GaudiMP.GMPBase.GMPComponent
def __init__ (self, nodeType, nodeID, queues, events, params, subworkers)
 
def Start (self)
 
def Engine (self)
 
def processConfiguration (self)
 
def SetupGaudiPython (self)
 
def StartGaudiPython (self)
 
def LoadTES (self, tbufferfile)
 
def getEventNumber (self)
 
def IdentifyWriters (self)
 
def dumpHistograms (self)
 
def Initialize (self)
 
def Finalize (self)
 
def Report (self)
 
def __init__ (self, nodeType, nodeID, queues, events, params, subworkers)
 
def Start (self)
 
def Engine (self)
 
def processConfiguration (self)
 
def SetupGaudiPython (self)
 
def StartGaudiPython (self)
 
def LoadTES (self, tbufferfile)
 
def getEventNumber (self)
 
def IdentifyWriters (self)
 
def dumpHistograms (self)
 
def Initialize (self)
 
def Finalize (self)
 
def Report (self)
 

Public Attributes

 writerDict
 
 vetoAlgs
 
 eventOutput
 
 filerecordsAgent
 
 nIn
 
 firstEvTime
 
 currentEvent
 
 tTime
 
 a
 
 evt
 
 hvt
 
 fsr
 
 inc
 
 pers
 
 ts
 
 cntr
 
 TS
 
- Public Attributes inherited from GaudiMP.GMPBase.GMPComponent
 nodeType
 
 finalEvent
 
 lastEvent
 
 log
 
 subworkers
 
 nodeID
 
 currentEvent
 
 queues
 
 num
 
 app
 
 evcom
 
 evcoms
 
 hq
 
 fq
 
 nIn
 
 nOut
 
 stat
 
 iTime
 
 rTime
 
 fTime
 
 firstEvTime
 
 tTime
 
 proc
 
 a
 
 evt
 
 hvt
 
 fsr
 
 inc
 
 pers
 
 ts
 
 TS
 
 cntr
 

Detailed Description

Definition at line 775 of file GMPBase.py.

Constructor & Destructor Documentation

def GaudiMP.GMPBase.Subworker.__init__ (   self,
  workerID,
  queues,
  events,
  params,
  subworkers 
)

Definition at line 776 of file GMPBase.py.

776  def __init__( self, workerID, queues, events, params, subworkers ) :
777  GMPComponent.__init__(self,'Worker', workerID, queues, events, params, subworkers )
778  # Identify the writer streams
780  # Identify the accept/veto checks for each event
781  self.acceptAlgs, self.requireAlgs, self.vetoAlgs = self.getCheckAlgs()
782  self.log.info("Subworker-%i Created OK"%(self.nodeID))
783  self.eventOutput = True
784 
def __init__(self, workerID, queues, events, params, subworkers)
Definition: GMPBase.py:776
def GaudiMP.GMPBase.Subworker.__init__ (   self,
  workerID,
  queues,
  events,
  params,
  subworkers 
)

Definition at line 776 of file GMPBase.py.

776  def __init__( self, workerID, queues, events, params, subworkers ) :
777  GMPComponent.__init__(self,'Worker', workerID, queues, events, params, subworkers )
778  # Identify the writer streams
780  # Identify the accept/veto checks for each event
781  self.acceptAlgs, self.requireAlgs, self.vetoAlgs = self.getCheckAlgs()
782  self.log.info("Subworker-%i Created OK"%(self.nodeID))
783  self.eventOutput = True
784 
def __init__(self, workerID, queues, events, params, subworkers)
Definition: GMPBase.py:776

Member Function Documentation

def GaudiMP.GMPBase.Subworker.checkExecutedPassed (   self,
  algName 
)

Definition at line 896 of file GMPBase.py.

896  def checkExecutedPassed( self, algName ) :
897  if self.a.algorithm( algName )._ialg.isExecuted()\
898  and self.a.algorithm( algName )._ialg.filterPassed() :
899  return True
900  else :
901  return False
902 
def checkExecutedPassed(self, algName)
Definition: GMPBase.py:896
def GaudiMP.GMPBase.Subworker.checkExecutedPassed (   self,
  algName 
)

Definition at line 896 of file GMPBase.py.

896  def checkExecutedPassed( self, algName ) :
897  if self.a.algorithm( algName )._ialg.isExecuted()\
898  and self.a.algorithm( algName )._ialg.filterPassed() :
899  return True
900  else :
901  return False
902 
def checkExecutedPassed(self, algName)
Definition: GMPBase.py:896
def GaudiMP.GMPBase.Subworker.Engine (   self)

Definition at line 785 of file GMPBase.py.

785  def Engine( self ) :
786  # rename process
787  import os
788  import ctypes
789  libc = ctypes.CDLL('libc.so.6')
790  name = str(self.nodeType) + str(self.nodeID) + '\0'
791  libc.prctl(15,name,0,0,0)
792 
793  self.initEvent.set()
794  startEngine = time.time()
795  msg = self.a.service('MessageSvc')
796  msg.Format = '[' + self.log.name + '] % F%18W%S%7W%R%T %0W%M'
797 
798  self.log.name = "Worker-%i"%(self.nodeID)
799  self.log.info("Subworker %i starting Engine"%(self.nodeID))
801 
802  # populate the TESSerializer itemlist
803  self.log.info('EVT WRITERS ON WORKER : %i'\
804  %( len(self.writerDict['events'])))
805 
806  nEventWriters = len( self.writerDict[ "events" ] )
807  self.a.addAlgorithm( CollectHistograms(self) )
808 
809  # Begin processing
810  Go = True
811  while Go :
812  packet = self.evcom.receive( )
813  if packet : pass
814  else : continue
815  if packet == 'FINISHED' : break
816  evtNumber, tbin = packet # unpack
817  if self.cntr != None:
818 
819  self.cntr.setEventCounter( evtNumber )
820 
821  self.nIn += 1
822  self.TS.Load( tbin )
823 
824  t = time.time()
825  sc = self.a.executeEvent()
826  if self.nIn == 1 :
827  self.firstEvTime = time.time()-t
828  else :
829  self.rTime += (time.time()-t)
830  if sc.isSuccess() :
831  pass
832  else :
833  self.log.name = "Worker-%i"%(self.nodeID)
834  self.log.warning('Did not Execute Event')
835  self.evt.clearStore()
836  continue
837  if self.isEventPassed() :
838  pass
839  else :
840  self.log.name = "Worker-%i"%(self.nodeID)
841  self.log.warning( 'Event did not pass : %i'%(evtNumber) )
842  self.evt.clearStore()
843  continue
844  if self.eventOutput :
845  # It may be the case of generating Event Tags; hence
846  # no event output
848  tb = self.TS.Dump( )
849  self.evcom.send( (self.currentEvent, tb) )
850  self.nOut += 1
851  self.inc.fireIncident(gbl.Incident('Subworker','EndEvent'))
852  self.eventLoopSyncer.set()
853  self.evt.clearStore( )
854  self.log.name = "Worker-%i"%(self.nodeID)
855  self.log.info('Setting <Last> Event %s' %(self.nodeID))
856  self.lastEvent.set()
857 
858  self.evcom.finalize()
859  # Now send the FileRecords and stop/finalize the appMgr
860  self.filerecordsAgent.SendFileRecords()
861  self.tTime = time.time()-startEngine
862  self.Finalize()
863  self.Report()
864  #self.finalEvent.set()
865 
def GaudiMP.GMPBase.Subworker.Engine (   self)

Definition at line 785 of file GMPBase.py.

785  def Engine( self ) :
786  # rename process
787  import os
788  import ctypes
789  libc = ctypes.CDLL('libc.so.6')
790  name = str(self.nodeType) + str(self.nodeID) + '\0'
791  libc.prctl(15,name,0,0,0)
792 
793  self.initEvent.set()
794  startEngine = time.time()
795  msg = self.a.service('MessageSvc')
796  msg.Format = '[' + self.log.name + '] % F%18W%S%7W%R%T %0W%M'
797 
798  self.log.name = "Worker-%i"%(self.nodeID)
799  self.log.info("Subworker %i starting Engine"%(self.nodeID))
801 
802  # populate the TESSerializer itemlist
803  self.log.info('EVT WRITERS ON WORKER : %i'\
804  %( len(self.writerDict['events'])))
805 
806  nEventWriters = len( self.writerDict[ "events" ] )
807  self.a.addAlgorithm( CollectHistograms(self) )
808 
809  # Begin processing
810  Go = True
811  while Go :
812  packet = self.evcom.receive( )
813  if packet : pass
814  else : continue
815  if packet == 'FINISHED' : break
816  evtNumber, tbin = packet # unpack
817  if self.cntr != None:
818 
819  self.cntr.setEventCounter( evtNumber )
820 
821  self.nIn += 1
822  self.TS.Load( tbin )
823 
824  t = time.time()
825  sc = self.a.executeEvent()
826  if self.nIn == 1 :
827  self.firstEvTime = time.time()-t
828  else :
829  self.rTime += (time.time()-t)
830  if sc.isSuccess() :
831  pass
832  else :
833  self.log.name = "Worker-%i"%(self.nodeID)
834  self.log.warning('Did not Execute Event')
835  self.evt.clearStore()
836  continue
837  if self.isEventPassed() :
838  pass
839  else :
840  self.log.name = "Worker-%i"%(self.nodeID)
841  self.log.warning( 'Event did not pass : %i'%(evtNumber) )
842  self.evt.clearStore()
843  continue
844  if self.eventOutput :
845  # It may be the case of generating Event Tags; hence
846  # no event output
848  tb = self.TS.Dump( )
849  self.evcom.send( (self.currentEvent, tb) )
850  self.nOut += 1
851  self.inc.fireIncident(gbl.Incident('Subworker','EndEvent'))
852  self.eventLoopSyncer.set()
853  self.evt.clearStore( )
854  self.log.name = "Worker-%i"%(self.nodeID)
855  self.log.info('Setting <Last> Event %s' %(self.nodeID))
856  self.lastEvent.set()
857 
858  self.evcom.finalize()
859  # Now send the FileRecords and stop/finalize the appMgr
860  self.filerecordsAgent.SendFileRecords()
861  self.tTime = time.time()-startEngine
862  self.Finalize()
863  self.Report()
864  #self.finalEvent.set()
865 
def GaudiMP.GMPBase.Subworker.getCheckAlgs (   self)
For some output writers, a check is performed to see if the event has
executed certain algorithms.
These reside in the AcceptAlgs property for those writers

Definition at line 880 of file GMPBase.py.

880  def getCheckAlgs( self ) :
881  '''
882  For some output writers, a check is performed to see if the event has
883  executed certain algorithms.
884  These reside in the AcceptAlgs property for those writers
885  '''
886  acc = []
887  req = []
888  vet = []
889  for m in self.writerDict[ "events" ] :
890  if hasattr(m.w, 'AcceptAlgs') : acc += m.w.AcceptAlgs
891  if hasattr(m.w, 'RequireAlgs') : req += m.w.RequireAlgs
892  if hasattr(m.w, 'VetoAlgs') : vet += m.w.VetoAlgs
893  return (acc, req, vet)
894 
895 
def GaudiMP.GMPBase.Subworker.getCheckAlgs (   self)
For some output writers, a check is performed to see if the event has
executed certain algorithms.
These reside in the AcceptAlgs property for those writers

Definition at line 880 of file GMPBase.py.

880  def getCheckAlgs( self ) :
881  '''
882  For some output writers, a check is performed to see if the event has
883  executed certain algorithms.
884  These reside in the AcceptAlgs property for those writers
885  '''
886  acc = []
887  req = []
888  vet = []
889  for m in self.writerDict[ "events" ] :
890  if hasattr(m.w, 'AcceptAlgs') : acc += m.w.AcceptAlgs
891  if hasattr(m.w, 'RequireAlgs') : req += m.w.RequireAlgs
892  if hasattr(m.w, 'VetoAlgs') : vet += m.w.VetoAlgs
893  return (acc, req, vet)
894 
895 
def GaudiMP.GMPBase.Subworker.isEventPassed (   self)
Check the algorithm status for an event.
Depending on output writer settings, the event
  may be declined based on various criteria.
This is a transcript of the check that occurs in GaudiSvc::OutputStream

Definition at line 903 of file GMPBase.py.

903  def isEventPassed( self ) :
904  '''
905  Check the algorithm status for an event.
906  Depending on output writer settings, the event
907  may be declined based on various criteria.
908  This is a transcript of the check that occurs in GaudiSvc::OutputStream
909  '''
910  passed = False
911 
912  self.log.debug('self.acceptAlgs is %s'%(str(self.acceptAlgs)))
913  if self.acceptAlgs :
914  for name in self.acceptAlgs :
915  if self.checkExecutedPassed( name ) :
916  passed = True
917  break
918  else :
919  passed = True
920 
921  self.log.debug('self.requireAlgs is %s'%(str(self.requireAlgs)))
922  for name in self.requireAlgs :
923  if self.checkExecutedPassed( name ) :
924  pass
925  else :
926  self.log.info('Evt declined (requireAlgs) : %s'%(name) )
927  passed = False
928 
929  self.log.debug('self.vetoAlgs is %s'%(str(self.vetoAlgs)))
930  for name in self.vetoAlgs :
931  if self.checkExecutedPassed( name ) :
932  pass
933  else :
934  self.log.info( 'Evt declined : (vetoAlgs) : %s'%(name) )
935  passed = False
936  return passed
937 
938 # =============================================================================
def checkExecutedPassed(self, algName)
Definition: GMPBase.py:896
def GaudiMP.GMPBase.Subworker.isEventPassed (   self)
Check the algorithm status for an event.
Depending on output writer settings, the event
  may be declined based on various criteria.
This is a transcript of the check that occurs in GaudiSvc::OutputStream

Definition at line 903 of file GMPBase.py.

903  def isEventPassed( self ) :
904  '''
905  Check the algorithm status for an event.
906  Depending on output writer settings, the event
907  may be declined based on various criteria.
908  This is a transcript of the check that occurs in GaudiSvc::OutputStream
909  '''
910  passed = False
911 
912  self.log.debug('self.acceptAlgs is %s'%(str(self.acceptAlgs)))
913  if self.acceptAlgs :
914  for name in self.acceptAlgs :
915  if self.checkExecutedPassed( name ) :
916  passed = True
917  break
918  else :
919  passed = True
920 
921  self.log.debug('self.requireAlgs is %s'%(str(self.requireAlgs)))
922  for name in self.requireAlgs :
923  if self.checkExecutedPassed( name ) :
924  pass
925  else :
926  self.log.info('Evt declined (requireAlgs) : %s'%(name) )
927  passed = False
928 
929  self.log.debug('self.vetoAlgs is %s'%(str(self.vetoAlgs)))
930  for name in self.vetoAlgs :
931  if self.checkExecutedPassed( name ) :
932  pass
933  else :
934  self.log.info( 'Evt declined : (vetoAlgs) : %s'%(name) )
935  passed = False
936  return passed
937 
938 # =============================================================================
def checkExecutedPassed(self, algName)
Definition: GMPBase.py:896
def GaudiMP.GMPBase.Subworker.SetServices (   self,
  a,
  evt,
  hvt,
  fsr,
  inc,
  pers,
  ts,
  cntr 
)

Definition at line 866 of file GMPBase.py.

866  def SetServices(self,a, evt, hvt, fsr, inc, pers, ts , cntr):
867  self.a = a
868  self.evt = evt
869  self.hvt = hvt
870  self.fsr = fsr
871  #self.inc = inc
872  self.inc = self.a.service('IncidentSvc','IIncidentSvc')
873  self.pers = pers
874  self.ts = ts
875  self.cntr = cntr
876  self.TS = TESSerializer( self.ts, self.evt,
877  self.nodeType, self.nodeID, self.log )
878 
879 
def SetServices(self, a, evt, hvt, fsr, inc, pers, ts, cntr)
Definition: GMPBase.py:866
def GaudiMP.GMPBase.Subworker.SetServices (   self,
  a,
  evt,
  hvt,
  fsr,
  inc,
  pers,
  ts,
  cntr 
)

Definition at line 866 of file GMPBase.py.

866  def SetServices(self,a, evt, hvt, fsr, inc, pers, ts , cntr):
867  self.a = a
868  self.evt = evt
869  self.hvt = hvt
870  self.fsr = fsr
871  #self.inc = inc
872  self.inc = self.a.service('IncidentSvc','IIncidentSvc')
873  self.pers = pers
874  self.ts = ts
875  self.cntr = cntr
876  self.TS = TESSerializer( self.ts, self.evt,
877  self.nodeType, self.nodeID, self.log )
878 
879 
def SetServices(self, a, evt, hvt, fsr, inc, pers, ts, cntr)
Definition: GMPBase.py:866

Member Data Documentation

GaudiMP.GMPBase.Subworker.a

Definition at line 867 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.cntr

Definition at line 875 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.currentEvent

Definition at line 847 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.eventOutput

Definition at line 783 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.evt

Definition at line 868 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.filerecordsAgent

Definition at line 800 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.firstEvTime

Definition at line 827 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.fsr

Definition at line 870 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.hvt

Definition at line 869 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.inc

Definition at line 872 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.nIn

Definition at line 826 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.pers

Definition at line 873 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.ts

Definition at line 874 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.TS

Definition at line 876 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.tTime

Definition at line 861 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.vetoAlgs

Definition at line 781 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.writerDict

Definition at line 779 of file GMPBase.py.


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