| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Public Attributes | List of all members
GaudiMP.GMPBase.Subworker Class Reference
Inheritance diagram for GaudiMP.GMPBase.Subworker:
[legend]
Collaboration diagram for GaudiMP.GMPBase.Subworker:
[legend]

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

## Constructor & Destructor Documentation

## ◆ __init__()

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

Definition at line 805 of file GMPBase.py.

805 def __init__(self, workerID, queues, events, params, subworkers):
806 GMPComponent.__init__(self, 'Worker', workerID, queues, events, params,
807 subworkers)
808 # Identify the writer streams
809 self.writerDict = self.IdentifyWriters()
810 # Identify the accept/veto checks for each event
811 self.acceptAlgs, self.requireAlgs, self.vetoAlgs = self.getCheckAlgs()
812 self.log.info("Subworker-%i Created OK" % (self.nodeID))
813 self.eventOutput = True
814

## Member Function Documentation

## ◆ checkExecutedPassed()

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

Definition at line 930 of file GMPBase.py.

930 def checkExecutedPassed(self, algName):
931 if self.a.algorithm(algName)._ialg.isExecuted()\
932 and self.a.algorithm(algName)._ialg.filterPassed():
933 return True
934 else:
935 return False
936

## ◆ Engine()

def GaudiMP.GMPBase.Subworker.Engine | ( |  | self | ) |

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 815 of file GMPBase.py.

815 def Engine(self):
816 # rename process
817 import os
818 import ctypes
819 libc = ctypes.CDLL('libc.so.6')
820 name = str(self.nodeType) + str(self.nodeID) + '\0'
821 libc.prctl(15, name, 0, 0, 0)
822
823 self.initEvent.set()
824 startEngine = time.time()
825 msg = self.a.service('MessageSvc')
826 msg.Format = '%-13s ' % ('[' + self.log.name + ']') + self.msgFormat
827
828 self.log.name = "Worker-%i" % (self.nodeID)
829 self.log.info("Subworker %i starting Engine" % (self.nodeID))
830 self.filerecordsAgent = FileRecordsAgent(self)
831
832 # populate the TESSerializer itemlist
833 self.log.info(
834 'EVT WRITERS ON WORKER : %i' % (len(self.writerDict['events'])))
835
836 nEventWriters = len(self.writerDict["events"])
837 self.a.addAlgorithm(CollectHistograms(self))
838
839 # Begin processing
840 Go = True
841 while Go:
842 packet = self.evcom.receive()
843 if packet:
844 pass
845 else:
846 continue
847 if packet == 'FINISHED':
848 break
849 evtNumber, tbin = packet # unpack
850 if self.cntr != None:
851
852 self.cntr.setEventCounter(evtNumber)
853
854 self.nIn += 1
855 self.TS.Load(tbin)
856
857 t = time.time()
858 sc = self.a.executeEvent()
859 if self.nIn == 1:
860 self.firstEvTime = time.time() - t
861 else:
862 self.rTime += (time.time() - t)
863 if sc.isSuccess():
864 pass
865 else:
866 self.log.name = "Worker-%i" % (self.nodeID)
867 self.log.warning('Did not Execute Event')
868 self.evt.clearStore()
869 continue
870 if self.isEventPassed():
871 pass
872 else:
873 self.log.name = "Worker-%i" % (self.nodeID)
874 self.log.warning('Event did not pass : %i' % (evtNumber))
875 self.evt.clearStore()
876 continue
877 if self.eventOutput:
878 # It may be the case of generating Event Tags; hence
879 # no event output
880 self.currentEvent = self.getEventNumber()
881 tb = self.TS.Dump()
882 self.evcom.send((self.currentEvent, tb))
883 self.nOut += 1
884 self.inc.fireIncident(gbl.Incident('Subworker', 'EndEvent'))
885 self.eventLoopSyncer.set()
886 self.evt.clearStore()
887 self.log.name = "Worker-%i" % (self.nodeID)
888 self.log.info('Setting <Last> Event %s' % (self.nodeID))
889 self.lastEvent.set()
890
891 self.evcom.finalize()
892 # Now send the FileRecords and stop/finalize the appMgr
893 self.filerecordsAgent.SendFileRecords()
894 self.tTime = time.time() - startEngine
895 self.Finalize()
896 self.Report()
897 # self.finalEvent.set()
898

## ◆ 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 912 of file GMPBase.py.

912 def getCheckAlgs(self):
913 '''
914 For some output writers, a check is performed to see if the event has
915 executed certain algorithms.
916 These reside in the AcceptAlgs property for those writers
917 '''
918 acc = []
919 req = []
920 vet = []
921 for m in self.writerDict["events"]:
922 if hasattr(m.w, 'AcceptAlgs'):
923 acc += m.w.AcceptAlgs
924 if hasattr(m.w, 'RequireAlgs'):
925 req += m.w.RequireAlgs
926 if hasattr(m.w, 'VetoAlgs'):
927 vet += m.w.VetoAlgs
928 return (acc, req, vet)
929

## ◆ 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 937 of file GMPBase.py.

937 def isEventPassed(self):
938 '''
939 Check the algorithm status for an event.
940 Depending on output writer settings, the event
941 may be declined based on various criteria.
942 This is a transcript of the check that occurs in GaudiSvc::OutputStream
943 '''
944 passed = False
945
946 self.log.debug('self.acceptAlgs is %s' % (str(self.acceptAlgs)))
947 if self.acceptAlgs:
948 for name in self.acceptAlgs:
949 if self.checkExecutedPassed(name):
950 passed = True
951 break
952 else:
953 passed = True
954
955 self.log.debug('self.requireAlgs is %s' % (str(self.requireAlgs)))
956 for name in self.requireAlgs:
957 if self.checkExecutedPassed(name):
958 pass
959 else:
960 self.log.info('Evt declined (requireAlgs) : %s' % (name))
961 passed = False
962
963 self.log.debug('self.vetoAlgs is %s' % (str(self.vetoAlgs)))
964 for name in self.vetoAlgs:
965 if self.checkExecutedPassed(name):
966 pass
967 else:
968 self.log.info('Evt declined : (vetoAlgs) : %s' % (name))
969 passed = False
970 return passed
971
972
973 # =============================================================================
974
975

## ◆ SetServices()

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

Definition at line 899 of file GMPBase.py.

899 def SetServices(self, a, evt, hvt, fsr, inc, pers, ts, cntr):
900 self.a = a
901 self.evt = evt
902 self.hvt = hvt
903 self.fsr = fsr
904 #self.inc = inc
905 self.inc = self.a.service('IncidentSvc', 'IIncidentSvc')
906 self.pers = pers
907 self.ts = ts
908 self.cntr = cntr
909 self.TS = TESSerializer(self.ts, self.evt, self.nodeType, self.nodeID,
910 self.log)
911

## Member Data Documentation

## ◆ a

GaudiMP.GMPBase.Subworker.a

Definition at line 900 of file GMPBase.py.

## ◆ cntr

GaudiMP.GMPBase.Subworker.cntr

Definition at line 908 of file GMPBase.py.

## ◆ currentEvent

GaudiMP.GMPBase.Subworker.currentEvent

Definition at line 880 of file GMPBase.py.

## ◆ eventOutput

GaudiMP.GMPBase.Subworker.eventOutput

Definition at line 813 of file GMPBase.py.

## ◆ evt

GaudiMP.GMPBase.Subworker.evt

Definition at line 901 of file GMPBase.py.

## ◆ filerecordsAgent

GaudiMP.GMPBase.Subworker.filerecordsAgent

Definition at line 830 of file GMPBase.py.

## ◆ firstEvTime

GaudiMP.GMPBase.Subworker.firstEvTime

Definition at line 860 of file GMPBase.py.

## ◆ fsr

GaudiMP.GMPBase.Subworker.fsr

Definition at line 903 of file GMPBase.py.

## ◆ hvt

GaudiMP.GMPBase.Subworker.hvt

Definition at line 902 of file GMPBase.py.

## ◆ inc

GaudiMP.GMPBase.Subworker.inc

Definition at line 905 of file GMPBase.py.

## ◆ nIn

GaudiMP.GMPBase.Subworker.nIn

Definition at line 859 of file GMPBase.py.

## ◆ pers

GaudiMP.GMPBase.Subworker.pers

Definition at line 906 of file GMPBase.py.

## ◆ ts

GaudiMP.GMPBase.Subworker.ts

Definition at line 907 of file GMPBase.py.

## ◆ TS

GaudiMP.GMPBase.Subworker.TS

Definition at line 909 of file GMPBase.py.

## ◆ tTime

GaudiMP.GMPBase.Subworker.tTime

Definition at line 894 of file GMPBase.py.

## ◆ vetoAlgs

GaudiMP.GMPBase.Subworker.vetoAlgs

Definition at line 811 of file GMPBase.py.

## ◆ writerDict

GaudiMP.GMPBase.Subworker.writerDict

Definition at line 809 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py