| # 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.Writer Class Reference
Inheritance diagram for GaudiMP.GMPBase.Writer:
[legend]
Collaboration diagram for GaudiMP.GMPBase.Writer:
[legend]

## Public Member Functions
def | __init__
def | processConfiguration
def | Engine
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
| status
| histoAgent
| filerecordsAgent
| currentEvent
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 1167 of file GMPBase.py.

## Constructor & Destructor Documentation

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

Definition at line 1168 of file GMPBase.py.

1168
1169 def __init__( self, queues, events, params, subworkers ) :
1170 GMPComponent.__init__(self,'Writer', -2, queues, events, params, subworkers )
1171 # Identify the writer streams
1172 self.writerDict = self.IdentifyWriters( )
1173 # This keeps track of workers as they finish
1174 self.status = [False]*self.nWorkers
1175 self.log.name = "Writer--2"

## Member Function Documentation

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

Definition at line 1221 of file GMPBase.py.

1221
1222 def Engine( self ) :
1223 # rename process
1224 import os
1225 import ctypes
1226 libc = ctypes.CDLL('libc.so.6')
1227 name = str(self.nodeType) + str(self.nodeID) + '\0'
1228 libc.prctl(15,name,0,0,0)
1229
1230 startEngine = time.time()
1231 self.Initialize()
1232 self.histoAgent = HistoAgent( self )
1233 self.filerecordsAgent = FileRecordsAgent( self )
1234
1235 # Begin processing
1236 Go = True
1237 current = -1
1238 stopCriteria = self.nWorkers
1239 while Go :
1240 current = (current+1)%self.nWorkers
1241 packet = self.evcoms[current].receive( timeout=0.01 )
1242 if packet == None :
1243 continue
1244 if packet == 'FINISHED' :
1245 self.log.info('Writer got FINISHED flag : Worker %i'%(current))
1246
1247 self.status[current] = True
1248 if all(self.status) :
1249 self.log.info('FINISHED recd from all workers, break loop')
1250 break
1251 continue
1252 # otherwise, continue as normal
1253 self.nIn += 1 # update central count (maybe needed by FSR store)
1254 evtNumber, tbin = packet # unpack
1255 self.TS.Load( tbin )
1256 t = time.time()
1257 self.a.executeEvent()
1258 self.rTime += ( time.time()-t )
1259 self.currentEvent = self.getEventNumber( )
1260 self.evt.clearStore( )
1261 self.eventLoopSyncer.set()
1262 self.log.name = "Writer--2"
1263 self.log.info('Setting <Last> Event')
1264 self.lastEvent.set()
1265
1266 # finalisation steps
1267 [ e.finalize() for e in self.evcoms ]
1268 # Now do Histograms
1269 sc = self.histoAgent.Receive()
1270 sc = self.histoAgent.RebuildHistoStore()
1271 if sc.isSuccess() : self.log.info( 'Histo Store rebuilt ok' )
1272 else : self.log.warning( 'Histo Store Error in Rebuild' )
1273
1274 # Now do FileRecords
1275 sc = self.filerecordsAgent.Receive()
1276 self.filerecordsAgent.Rebuild()
1277 self.Finalize()
1278 #self.rTime = time.time()-startEngine
1279 self.Report()
1280
1281 # =============================================================================
1282
1283
1284
1285 # =============================================================================

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

Definition at line 1176 of file GMPBase.py.

1176
1177 def processConfiguration( self ) :
1178 # Writer :
1179 # No input
1180 # No Algs
1181 self.config[ 'ApplicationMgr' ].TopAlg = []
1182 self.config[ 'EventSelector' ].Input = []
1183
1184 self.config['MessageSvc'].Format = '[Writer] % F%18W%S%7W%R%T %0W%M'
1185
1186 # Now process the output writers
1187 for key, lst in self.writerDict.iteritems() :
1188 self.log.info( 'Writer Type : %s\t : %i'%(key, len(lst)) )
1189
1190 # Modify the name of the output file to reflect that it came
1191 # from a parallel processing
1192 #
1193 # Event Writers
1194 for m in self.writerDict[ "events" ] :
1195 self.log.debug( 'Processing Event Writer : %s'%(m) )
1196 newName = m.getNewName( '.', '.p%i.'%self.nWorkers )
1197 self.config[ m.key ].Output = newName
1198
1199 # Now, if there are no event writers, the FileRecords file
1200 # will fail to open, as it only opens an UPDATE version
1201 # of the existing Event Output File
1202 # So, if there are no event writers, edit the string of the
1203 # FileRecord Writer
1204
1205 # FileRecords Writers
1206 for m in self.writerDict[ "records" ] :
1207 self.log.debug( 'Processing FileRecords Writer: %s'%(m) )
1208 newName = m.getNewName( '.', '.p%i.'%self.nWorkers,
1209 extra=" OPT='RECREATE'" )
1210 self.config[ m.key ].Output = newName
1211
1212 # same for histos
1213 hs = "HistogramPersistencySvc"
1214 n = None
1215 if hs in self.config.keys() :
1216 n = self.config[ hs ].OutputFile
1217 if n :
1218 newName=self.config[hs].OutputFile.replace('.',\
1219 '.p%i.'%(self.nWorkers))
1220 self.config[ hs ].OutputFile = newName

## Member Data Documentation

GaudiMP.GMPBase.Writer.currentEvent

Definition at line 1258 of file GMPBase.py.

GaudiMP.GMPBase.Writer.filerecordsAgent

Definition at line 1232 of file GMPBase.py.

GaudiMP.GMPBase.Writer.histoAgent

Definition at line 1231 of file GMPBase.py.

GaudiMP.GMPBase.Writer.status

Definition at line 1173 of file GMPBase.py.

GaudiMP.GMPBase.Writer.writerDict

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