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

Constructor & Destructor Documentation

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

Definition at line 777 of file GMPBase.py.

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

Definition at line 777 of file GMPBase.py.

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

Member Function Documentation

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

Definition at line 897 of file GMPBase.py.

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

Definition at line 897 of file GMPBase.py.

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

Definition at line 786 of file GMPBase.py.

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

Definition at line 786 of file GMPBase.py.

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

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

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

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

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

Definition at line 867 of file GMPBase.py.

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

Definition at line 867 of file GMPBase.py.

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

Member Data Documentation

GaudiMP.GMPBase.Subworker.a

Definition at line 868 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.cntr

Definition at line 876 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.currentEvent

Definition at line 848 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.eventOutput

Definition at line 784 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.evt

Definition at line 869 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.filerecordsAgent

Definition at line 801 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.firstEvTime

Definition at line 828 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.fsr

Definition at line 871 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.hvt

Definition at line 870 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.inc

Definition at line 873 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.nIn

Definition at line 827 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.pers

Definition at line 874 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.ts

Definition at line 875 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.TS

Definition at line 877 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.tTime

Definition at line 862 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.vetoAlgs

Definition at line 782 of file GMPBase.py.

GaudiMP.GMPBase.Subworker.writerDict

Definition at line 780 of file GMPBase.py.


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