The Gaudi Framework  v36r6 (b1ee9983)
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)
 
- Public Member Functions inherited from GaudiMP.GMPBase.GMPComponent
def __init__ (self, nodeType, nodeID, queues, events, params, subworkers)
 
def Start (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
 
 msgFormat
 
 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 832 of file GMPBase.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 833 of file GMPBase.py.

833  def __init__(self, workerID, queues, events, params, subworkers):
834  GMPComponent.__init__(
835  self, "Worker", workerID, queues, events, params, subworkers
836  )
837  # Identify the writer streams
838  self.writerDict = self.IdentifyWriters()
839  # Identify the accept/veto checks for each event
840  self.acceptAlgs, self.requireAlgs, self.vetoAlgs = self.getCheckAlgs()
841  self.log.info("Subworker-%i Created OK" % (self.nodeID))
842  self.eventOutput = True
843 

Member Function Documentation

◆ checkExecutedPassed()

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

Definition at line 958 of file GMPBase.py.

958  def checkExecutedPassed(self, algName):
959  if (
960  self.a.algorithm(algName)._ialg.isExecuted()
961  and self.a.algorithm(algName)._ialg.filterPassed()
962  ):
963  return True
964  else:
965  return False
966 

◆ Engine()

def GaudiMP.GMPBase.Subworker.Engine (   self)

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 844 of file GMPBase.py.

844  def Engine(self):
845  # rename process
846  import ctypes
847  import os
848 
849  libc = ctypes.CDLL("libc.so.6")
850  name = str(self.nodeType) + str(self.nodeID) + "\0"
851  libc.prctl(15, name, 0, 0, 0)
852 
853  self.initEvent.set()
854  startEngine = time.time()
855  msg = self.a.service("MessageSvc")
856  msg.Format = "%-13s " % ("[" + self.log.name + "]") + self.msgFormat
857 
858  self.log.name = "Worker-%i" % (self.nodeID)
859  self.log.info("Subworker %i starting Engine" % (self.nodeID))
860  self.filerecordsAgent = FileRecordsAgent(self)
861 
862  # populate the TESSerializer itemlist
863  self.log.info("EVT WRITERS ON WORKER : %i" % (len(self.writerDict["events"])))
864 
865  nEventWriters = len(self.writerDict["events"])
866  self.a.addAlgorithm(CollectHistograms(self))
867 
868  # Begin processing
869  Go = True
870  while Go:
871  packet = self.evcom.receive()
872  if packet:
873  pass
874  else:
875  continue
876  if packet == "FINISHED":
877  break
878  evtNumber, tbin = packet # unpack
879  if self.cntr != None:
880 
881  self.cntr.setEventCounter(evtNumber)
882 
883  self.nIn += 1
884  self.TS.Load(tbin)
885 
886  t = time.time()
887  sc = self.a.executeEvent()
888  if self.nIn == 1:
889  self.firstEvTime = time.time() - t
890  else:
891  self.rTime += time.time() - t
892  if sc.isSuccess():
893  pass
894  else:
895  self.log.name = "Worker-%i" % (self.nodeID)
896  self.log.warning("Did not Execute Event")
897  self.evt.clearStore()
898  continue
899  if self.isEventPassed():
900  pass
901  else:
902  self.log.name = "Worker-%i" % (self.nodeID)
903  self.log.warning("Event did not pass : %i" % (evtNumber))
904  self.evt.clearStore()
905  continue
906  if self.eventOutput:
907  # It may be the case of generating Event Tags; hence
908  # no event output
909  self.currentEvent = self.getEventNumber()
910  tb = self.TS.Dump()
911  self.evcom.send((self.currentEvent, tb))
912  self.nOut += 1
913  self.inc.fireIncident(gbl.Incident("Subworker", "EndEvent"))
914  self.eventLoopSyncer.set()
915  self.evt.clearStore()
916  self.log.name = "Worker-%i" % (self.nodeID)
917  self.log.info("Setting <Last> Event %s" % (self.nodeID))
918  self.lastEvent.set()
919 
920  self.evcom.finalize()
921  # Now send the FileRecords and stop/finalize the appMgr
922  self.filerecordsAgent.SendFileRecords()
923  self.tTime = time.time() - startEngine
924  self.Finalize()
925  self.Report()
926  # self.finalEvent.set()
927 

◆ getCheckAlgs()

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

940  def getCheckAlgs(self):
941  """
942  For some output writers, a check is performed to see if the event has
943  executed certain algorithms.
944  These reside in the AcceptAlgs property for those writers
945  """
946  acc = []
947  req = []
948  vet = []
949  for m in self.writerDict["events"]:
950  if hasattr(m.w, "AcceptAlgs"):
951  acc += m.w.AcceptAlgs
952  if hasattr(m.w, "RequireAlgs"):
953  req += m.w.RequireAlgs
954  if hasattr(m.w, "VetoAlgs"):
955  vet += m.w.VetoAlgs
956  return (acc, req, vet)
957 

◆ isEventPassed()

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

967  def isEventPassed(self):
968  """
969  Check the algorithm status for an event.
970  Depending on output writer settings, the event
971  may be declined based on various criteria.
972  This is a transcript of the check that occurs in GaudiSvc::OutputStream
973  """
974  passed = False
975 
976  self.log.debug("self.acceptAlgs is %s" % (str(self.acceptAlgs)))
977  if self.acceptAlgs:
978  for name in self.acceptAlgs:
979  if self.checkExecutedPassed(name):
980  passed = True
981  break
982  else:
983  passed = True
984 
985  self.log.debug("self.requireAlgs is %s" % (str(self.requireAlgs)))
986  for name in self.requireAlgs:
987  if self.checkExecutedPassed(name):
988  pass
989  else:
990  self.log.info("Evt declined (requireAlgs) : %s" % (name))
991  passed = False
992 
993  self.log.debug("self.vetoAlgs is %s" % (str(self.vetoAlgs)))
994  for name in self.vetoAlgs:
995  if self.checkExecutedPassed(name):
996  pass
997  else:
998  self.log.info("Evt declined : (vetoAlgs) : %s" % (name))
999  passed = False
1000  return passed
1001 
1002 
1003 # =============================================================================
1004 
1005 

◆ SetServices()

def GaudiMP.GMPBase.Subworker.SetServices (   self,
  a,
  evt,
  hvt,
  fsr,
  inc,
  pers,
  ts,
  cntr 
)

Definition at line 928 of file GMPBase.py.

928  def SetServices(self, a, evt, hvt, fsr, inc, pers, ts, cntr):
929  self.a = a
930  self.evt = evt
931  self.hvt = hvt
932  self.fsr = fsr
933  # self.inc = inc
934  self.inc = self.a.service("IncidentSvc", "IIncidentSvc")
935  self.pers = pers
936  self.ts = ts
937  self.cntr = cntr
938  self.TS = TESSerializer(self.ts, self.evt, self.nodeType, self.nodeID, self.log)
939 

Member Data Documentation

◆ a

GaudiMP.GMPBase.Subworker.a

Definition at line 929 of file GMPBase.py.

◆ cntr

GaudiMP.GMPBase.Subworker.cntr

Definition at line 937 of file GMPBase.py.

◆ currentEvent

GaudiMP.GMPBase.Subworker.currentEvent

Definition at line 909 of file GMPBase.py.

◆ eventOutput

GaudiMP.GMPBase.Subworker.eventOutput

Definition at line 842 of file GMPBase.py.

◆ evt

GaudiMP.GMPBase.Subworker.evt

Definition at line 930 of file GMPBase.py.

◆ filerecordsAgent

GaudiMP.GMPBase.Subworker.filerecordsAgent

Definition at line 860 of file GMPBase.py.

◆ firstEvTime

GaudiMP.GMPBase.Subworker.firstEvTime

Definition at line 889 of file GMPBase.py.

◆ fsr

GaudiMP.GMPBase.Subworker.fsr

Definition at line 932 of file GMPBase.py.

◆ hvt

GaudiMP.GMPBase.Subworker.hvt

Definition at line 931 of file GMPBase.py.

◆ inc

GaudiMP.GMPBase.Subworker.inc

Definition at line 934 of file GMPBase.py.

◆ nIn

GaudiMP.GMPBase.Subworker.nIn

Definition at line 888 of file GMPBase.py.

◆ pers

GaudiMP.GMPBase.Subworker.pers

Definition at line 935 of file GMPBase.py.

◆ ts

GaudiMP.GMPBase.Subworker.ts

Definition at line 936 of file GMPBase.py.

◆ TS

GaudiMP.GMPBase.Subworker.TS

Definition at line 938 of file GMPBase.py.

◆ tTime

GaudiMP.GMPBase.Subworker.tTime

Definition at line 923 of file GMPBase.py.

◆ vetoAlgs

GaudiMP.GMPBase.Subworker.vetoAlgs

Definition at line 840 of file GMPBase.py.

◆ writerDict

GaudiMP.GMPBase.Subworker.writerDict

Definition at line 838 of file GMPBase.py.


The documentation for this class was generated from the following file:
GaudiPython.Pythonizations.executeEvent
executeEvent
Helpers for re-entrant interfaces.
Definition: Pythonizations.py:584