| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# GaudiMP::GMPBase::Worker Class Reference

Inheritance diagram for GaudiMP::GMPBase::Worker:
[legend]
Collaboration diagram for GaudiMP::GMPBase::Worker:
[legend]

List of all members.

## Public Member Functions
def | __init__
def | processConfiguration
def | Engine
def | getCheckAlgs
def | checkExecutedPassed
def | isEventPassed
## Public Attributes
| writerDict
| vetoAlgs
| eventOutput
| nodeID
| filerecordsAgent
| nIn
| firstEvTime
| currentEvent
| tTime

## Detailed Description

Definition at line 731 of file GMPBase.py.

## Member Function Documentation

def GaudiMP::GMPBase::Worker::__init__ | ( |  | self,
|  |  | workerID,
|  |  | queues,
|  |  | events,
|  |  | params |
| ) |  |  |

Definition at line 732 of file GMPBase.py.

    00733                                                            :
    00734         GMPComponent.__init__(self,'Worker', workerID, queues, events, params)
    00735         # Identify the writer streams
    00736         self.writerDict = self.IdentifyWriters( )
    00737         # Identify the accept/veto checks for each event
    00738         self.acceptAlgs, self.requireAlgs, self.vetoAlgs = self.getCheckAlgs()
    00739         self.log.debug("Worker-%i Created OK"%(self.nodeID))
    00740         self.eventOutput = True

def GaudiMP::GMPBase::Worker::checkExecutedPassed | ( |  | self,
|  |  | algName |
| ) |  |  |

Definition at line 861 of file GMPBase.py.

    00862                                              :
    00863         if  self.a.algorithm( algName )._ialg.isExecuted()\
    00864         and self.a.algorithm( algName )._ialg.filterPassed() :
    00865             return True
    00866         else :
    00867             return False

def GaudiMP::GMPBase::Worker::Engine | ( |  | self | ) |

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 768 of file GMPBase.py.

    00769                        :
    00770         startEngine = time.time()
    00771         self.log.name = "Worker-%i"%(self.nodeID)
    00772         self.log.info("Worker %i starting Engine"%(self.nodeID))
    00773         self.Initialize()
    00774         self.filerecordsAgent = FileRecordsAgent(self)
    00775
    00776         # populate the TESSerializer itemlist
    00777         self.log.info('EVT WRITERS ON WORKER : %i'\
    00778                        %( len(self.writerDict['events'])))
    00779
    00780         nEventWriters = len( self.writerDict[ "events" ] )
    00781         if nEventWriters :
    00782             for m in self.writerDict[ "events" ] :
    00783                 for item in m.ItemList :
    00784                     self.log.debug(' adding ItemList Item to ts : %s'%(item))
    00785                     self.ts.addItem( item )
    00786                 for item in m.OptItemList :
    00787                     self.log.debug(' adding Optional Item to ts : %s'%(item))
    00788                     self.ts.addOptItem( item )
    00789         else :
    00790             self.log.info( 'There is no Event Output for this app' )
    00791             self.eventOutput = False
    00792
    00793         # add the Histogram Collection Algorithm
    00794         self.a.addAlgorithm( CollectHistograms(self) )
    00795
    00796         # Begin processing
    00797         self.log.name = "Worker-%i"%(self.nodeID)
    00798         Go = True
    00799         while Go :
    00800             packet = self.evcom.receive( )
    00801             if packet : pass
    00802             else      : continue
    00803             if packet == 'FINISHED' : break
    00804             evtNumber, tbin = packet    # unpack
    00805             self.nIn += 1
    00806             self.TS.Load( tbin )
    00807             # print 'Worker-%i : Event %i'%(self.nodeID, evtNumber)
    00808             t = time.time()
    00809             sc = self.a.executeEvent()
    00810             if self.nIn == 1 :
    00811                 self.firstEvTime = time.time()-t
    00812             else :
    00813                 self.rTime += (time.time()-t)
    00814             if sc.isSuccess() :
    00815                 pass
    00816             else :
    00817                 self.log.warning('Did not Execute Event')
    00818                 self.evt.clearStore()
    00819                 continue
    00820             if self.isEventPassed() :
    00821                 pass
    00822             else :
    00823                 self.log.warning( 'Event did not pass : %i'%(evtNumber) )
    00824                 self.evt.clearStore()
    00825                 continue
    00826             if self.eventOutput :
    00827                 # It may be the case of generating Event Tags; hence
    00828                 #   no event output
    00829                 self.currentEvent = self.getEventNumber( )
    00830                 tb = self.TS.Dump( )
    00831                 self.evcom.send( (self.currentEvent, tb) )
    00832                 self.nOut += 1
    00833             self.eventLoopSyncer.set()
    00834             self.evt.clearStore( )
    00835         self.log.info('Setting <Last> Event')
    00836         self.lastEvent.set()
    00837
    00838         self.evcom.finalize()
    00839         self.log.info( 'Worker-%i Finished Processing Events'%(self.nodeID) )
    00840         # Now send the FileRecords and stop/finalize the appMgr
    00841         self.filerecordsAgent.SendFileRecords()
    00842         self.Finalize()
    00843         self.tTime = time.time()-startEngine
    00844         self.Report()

def GaudiMP::GMPBase::Worker::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 845 of file GMPBase.py.

    00846                              :
    00847         '''
    00848         For some output writers, a check is performed to see if the event has
    00849         executed certain algorithms.
    00850         These reside in the AcceptAlgs property for those writers
    00851         '''
    00852         acc = []
    00853         req = []
    00854         vet = []
    00855         for m in self.writerDict[ "events" ] :
    00856             if hasattr(m.w, 'AcceptAlgs')  : acc += m.w.AcceptAlgs
    00857             if hasattr(m.w, 'RequireAlgs') : req += m.w.RequireAlgs
    00858             if hasattr(m.w, 'VetoAlgs')    : vet += m.w.VetoAlgs
    00859         return (acc, req, vet)
    00860

def GaudiMP::GMPBase::Worker::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 868 of file GMPBase.py.

    00869                               :
    00870         '''
    00871         Check the algorithm status for an event.
    00872         Depending on output writer settings, the event
    00873           may be declined based on various criteria.
    00874         This is a transcript of the check that occurs in GaudiSvc::OutputStream
    00875         '''
    00876         passed = False
    00877
    00878         self.log.debug('self.acceptAlgs is %s'%(str(self.acceptAlgs)))
    00879         if self.acceptAlgs :
    00880             for name in self.acceptAlgs :
    00881                 if self.checkExecutedPassed( name ) :
    00882                     passed = True
    00883                     break
    00884         else :
    00885             passed = True
    00886
    00887         self.log.debug('self.requireAlgs is %s'%(str(self.requireAlgs)))
    00888         for name in self.requireAlgs :
    00889             if self.checkExecutedPassed( name ) :
    00890                 pass
    00891             else :
    00892                 self.log.info('Evt declined (requireAlgs) : %s'%(name) )
    00893                 passed = False
    00894
    00895         self.log.debug('self.vetoAlgs is %s'%(str(self.vetoAlgs)))
    00896         for name in self.vetoAlgs :
    00897             if self.checkExecutedPassed( name ) :
    00898                 pass
    00899             else :
    00900                 self.log.info( 'Evt declined : (vetoAlgs) : %s'%(name) )
    00901                 passed = False
    00902         return passed
    00903
    00904 # =============================================================================

def GaudiMP::GMPBase::Worker::processConfiguration | ( |  | self | ) |

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 741 of file GMPBase.py.

    00742                                      :
    00743         # Worker :
    00744         #   No input
    00745         #   No output
    00746         #   No Histos
    00747         self.config[ 'EventSelector'  ].Input     = []
    00748         self.config[ 'ApplicationMgr' ].OutStream = []
    00749         if "HistogramPersistencySvc" in self.config.keys() :
    00750             self.config[ 'HistogramPersistencySvc' ].OutputFile = ''
    00751         formatHead = '[Worker-%i] '%(self.nodeID)
    00752         self.config['MessageSvc'].Format = formatHead+'% F%18W%S%7W%R%T %0W%M'
    00753
    00754         for key, lst in self.writerDict.iteritems() :
    00755             self.log.info( 'Writer Type : %s\t : %i'%(key, len(lst)) )
    00756
    00757         for m in self.writerDict[ "tuples" ] :
    00758             # rename Tuple output file with an appendix
    00759             # based on worker id, for merging later
    00760             newName = m.getNewName( '.', '.w%i.'%(self.nodeID) )
    00761             self.config[ m.key ].Output = newName
    00762
    00763         # Suppress INFO Output for all but Worker-0
    00764         if self.nodeID == 0 :
    00765             pass
    00766         else                :
    00767             self.config[ 'MessageSvc' ].OutputLevel = ERROR

## Member Data Documentation

GaudiMP::GMPBase::Worker::currentEvent

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 828 of file GMPBase.py.

GaudiMP::GMPBase::Worker::eventOutput

Definition at line 739 of file GMPBase.py.

GaudiMP::GMPBase::Worker::filerecordsAgent

Definition at line 773 of file GMPBase.py.

GaudiMP::GMPBase::Worker::firstEvTime

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 810 of file GMPBase.py.

GaudiMP::GMPBase::Worker::nIn

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 809 of file GMPBase.py.

GaudiMP::GMPBase::Worker::nodeID

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 763 of file GMPBase.py.

GaudiMP::GMPBase::Worker::tTime

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 842 of file GMPBase.py.

GaudiMP::GMPBase::Worker::vetoAlgs

Definition at line 737 of file GMPBase.py.

GaudiMP::GMPBase::Worker::writerDict

Definition at line 735 of file GMPBase.py.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines