| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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__
def | Engine
def | SetServices
def | getCheckAlgs
def | checkExecutedPassed
def | isEventPassed
Public Member Functions inherited from GaudiMP.GMPBase.GMPComponent
def | __init__
def | Start
def | Engine
def | processConfiguration
def | SetupGaudiPython
def | StartGaudiPython
def | LoadTES
def | getEventNumber
def | IdentifyWriters
def | dumpHistograms
def | Initialize
def | Finalize
def | Report

## 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
778 def __init__( self, workerID, queues, events, params, subworkers ) :
779 GMPComponent.__init__(self,'Worker', workerID, queues, events, params, subworkers )
780 # Identify the writer streams
781 self.writerDict = self.IdentifyWriters( )
782 # Identify the accept/veto checks for each event
783 self.acceptAlgs, self.requireAlgs, self.vetoAlgs = self.getCheckAlgs()
784 self.log.info("Subworker-%i Created OK"%(self.nodeID))
785 self.eventOutput = True

## Member Function Documentation

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

Definition at line 897 of file GMPBase.py.

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

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

Definition at line 786 of file GMPBase.py.

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

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
882 def getCheckAlgs( self ) :
883 '''
884 For some output writers, a check is performed to see if the event has
885 executed certain algorithms.
886 These reside in the AcceptAlgs property for those writers
887 '''
888 acc = []
889 req = []
890 vet = []
891 for m in self.writerDict[ "events" ] :
892 if hasattr(m.w, 'AcceptAlgs') : acc += m.w.AcceptAlgs
893 if hasattr(m.w, 'RequireAlgs') : req += m.w.RequireAlgs
894 if hasattr(m.w, 'VetoAlgs') : vet += m.w.VetoAlgs
895 return (acc, req, vet)
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
905 def isEventPassed( self ) :
906 '''
907 Check the algorithm status for an event.
908 Depending on output writer settings, the event
909 may be declined based on various criteria.
910 This is a transcript of the check that occurs in GaudiSvc::OutputStream
911 '''
912 passed = False
913
914 self.log.debug('self.acceptAlgs is %s'%(str(self.acceptAlgs)))
915 if self.acceptAlgs :
916 for name in self.acceptAlgs :
917 if self.checkExecutedPassed( name ) :
918 passed = True
919 break
920 else :
921 passed = True
922
923 self.log.debug('self.requireAlgs is %s'%(str(self.requireAlgs)))
924 for name in self.requireAlgs :
925 if self.checkExecutedPassed( name ) :
926 pass
927 else :
928 self.log.info('Evt declined (requireAlgs) : %s'%(name) )
929 passed = False
930
931 self.log.debug('self.vetoAlgs is %s'%(str(self.vetoAlgs)))
932 for name in self.vetoAlgs :
933 if self.checkExecutedPassed( name ) :
934 pass
935 else :
936 self.log.info( 'Evt declined : (vetoAlgs) : %s'%(name) )
937 passed = False
938 return passed
939
# =============================================================================

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

Definition at line 867 of file GMPBase.py.

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

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiMP/python/GaudiMP/GMPBase.py