| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Public Attributes

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

## Constructor & Destructor Documentation

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

Definition at line 908 of file GMPBase.py.

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

## Member Function Documentation

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

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 961 of file GMPBase.py.

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

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

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 916 of file GMPBase.py.

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

## Member Data Documentation

GaudiMP::GMPBase::Writer::currentEvent

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 961 of file GMPBase.py.

GaudiMP::GMPBase::Writer::filerecordsAgent

Definition at line 961 of file GMPBase.py.

GaudiMP::GMPBase::Writer::histoAgent

Definition at line 961 of file GMPBase.py.

GaudiMP::GMPBase::Writer::rTime

Reimplemented from GaudiMP::GMPBase::GMPComponent.

Definition at line 961 of file GMPBase.py.

GaudiMP::GMPBase::Writer::status

Definition at line 908 of file GMPBase.py.

GaudiMP::GMPBase::Writer::writerDict

Definition at line 908 of file GMPBase.py.

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

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

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