| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# GaudiMP::GMPBase::Writer Class Reference

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

List of all members.

## Public Member Functions
def | __init__
def | processConfiguration
def | Engine
## Public Attributes
| writerDict
| status
| histoAgent
| filerecordsAgent
| currentEvent
| rTime

## Detailed Description

Definition at line 905 of file GMPBase.py.

## Member Function Documentation

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

Definition at line 906 of file GMPBase.py.

    00907                                                  :
    00908         GMPComponent.__init__(self,'Writer', -2, queues, events, params)
    00909         # Identify the writer streams
    00910         self.writerDict = self.IdentifyWriters( )
    00911         # This keeps track of workers as they finish
    00912         self.status = [False]*self.nWorkers
    00913         self.log.name = "Writer--2"

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

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 959 of file GMPBase.py.

    00960                        :
    00961         startEngine = time.time()
    00962         self.Initialize()
    00963         self.histoAgent = HistoAgent( self )
    00964         self.filerecordsAgent = FileRecordsAgent( self )
    00965
    00966         # Begin processing
    00967         Go      = True
    00968         current = -1
    00969         stopCriteria = self.nWorkers
    00970         while Go :
    00971             current = (current+1)%self.nWorkers
    00972             packet = self.evcoms[current].receive( timeout=0.01 )
    00973             if packet == None :
    00974                 continue
    00975             if packet == 'FINISHED' :
    00976                 self.log.info('Writer got FINISHED flag : Worker %i'%(current))
    00977                 self.status[current] = True
    00978                 if all(self.status) :
    00979                     self.log.info('FINISHED recd from all workers, break loop')
    00980                     break
    00981                 continue
    00982             # otherwise, continue as normal
    00983             self.nIn += 1    # update central count (maybe needed by FSR store)
    00984             evtNumber, tbin = packet    # unpack
    00985             self.TS.Load( tbin )
    00986             t  = time.time()
    00987             self.a.executeEvent()
    00988             self.rTime += ( time.time()-t )
    00989             self.currentEvent = self.getEventNumber( )
    00990             self.evt.clearStore( )
    00991             self.eventLoopSyncer.set()
    00992         self.log.name = "Writer--2"
    00993         self.log.info('Setting <Last> Event')
    00994         self.lastEvent.set()
    00995
    00996         # finalisation steps
    00997         [ e.finalize() for e in self.evcoms ]
    00998         # Now do Histograms
    00999         sc = self.histoAgent.Receive()
    01000         sc = self.histoAgent.RebuildHistoStore()
    01001         if sc.isSuccess() : self.log.info( 'Histo Store rebuilt ok' )
    01002         else              : self.log.warning( 'Histo Store Error in Rebuild' )
    01003
    01004         # Now do FileRecords
    01005         sc = self.filerecordsAgent.Receive()
    01006         self.filerecordsAgent.Rebuild()
    01007         self.Finalize()
    01008         self.rTime = time.time()-startEngine
    01009         self.Report()
    01010
    01011 # =============================================================================
    01012
    01013
    01014
    01015 # =============================================================================

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

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 914 of file GMPBase.py.

    00915                                      :
    00916         # Writer :
    00917         #   No input
    00918         #   No Algs
    00919         self.config[ 'ApplicationMgr' ].TopAlg = []
    00920         self.config[ 'EventSelector'  ].Input  = []
    00921
    00922         self.config['MessageSvc'].Format = '[Writer] % F%18W%S%7W%R%T %0W%M'
    00923
    00924         # Now process the output writers
    00925         for key, lst in self.writerDict.iteritems() :
    00926             self.log.info( 'Writer Type : %s\t : %i'%(key, len(lst)) )
    00927
    00928         # Modify the name of the output file to reflect that it came
    00929         #  from a parallel processing
    00930         #
    00931         # Event Writers
    00932         for m in self.writerDict[ "events" ] :
    00933             self.log.debug( 'Processing Event Writer : %s'%(m) )
    00934             newName = m.getNewName( '.', '.p%i.'%self.nWorkers )
    00935             self.config[ m.key ].Output = newName
    00936
    00937         # Now, if there are no event writers, the FileRecords file
    00938         #   will fail to open, as it only opens an UPDATE version
    00939         #   of the existing Event Output File
    00940         # So, if there are no event writers, edit the string of the
    00941         #   FileRecord Writer
    00942
    00943         # FileRecords Writers
    00944         for m in self.writerDict[ "records" ] :
    00945             self.log.debug( 'Processing FileRecords Writer: %s'%(m) )
    00946             newName = m.getNewName( '.', '.p%i.'%self.nWorkers,
    00947                                        extra=" OPT='RECREATE'" )
    00948             self.config[ m.key ].Output = newName
    00949
    00950         # same for histos
    00951         hs = "HistogramPersistencySvc"
    00952         n = None
    00953         if hs in self.config.keys() :
    00954             n = self.config[ hs ].OutputFile
    00955         if n :
    00956             newName=self.config[hs].OutputFile.replace('.',\
    00957                                                        '.p%i.'%(self.nWorkers))
    00958             self.config[ hs ].OutputFile = newName

## Member Data Documentation

GaudiMP::GMPBase::Writer::currentEvent

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 988 of file GMPBase.py.

GaudiMP::GMPBase::Writer::filerecordsAgent

Definition at line 963 of file GMPBase.py.

GaudiMP::GMPBase::Writer::histoAgent

Definition at line 962 of file GMPBase.py.

GaudiMP::GMPBase::Writer::rTime

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 1007 of file GMPBase.py.

GaudiMP::GMPBase::Writer::status

Definition at line 911 of file GMPBase.py.

GaudiMP::GMPBase::Writer::writerDict

Definition at line 909 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