| The Gaudi Framework v27r1

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

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

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__ (self, queues, events, params, subworkers)
def | processConfiguration (self)
def | Engine (self)
Public Member Functions inherited from GaudiMP.GMPBase.GMPComponent
def | __init__ (self, nodeType, nodeID, queues, events, params, subworkers)
def | Start (self)
def | Engine (self)
def | processConfiguration (self)
def | SetupGaudiPython (self)
def | StartGaudiPython (self)
def | LoadTES (self, tbufferfile)
def | getEventNumber (self)
def | IdentifyWriters (self)
def | dumpHistograms (self)
def | Initialize (self)
def | Finalize (self)
def | Report (self)

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

## Constructor & Destructor Documentation

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

Definition at line 1167 of file GMPBase.py.

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

## Member Function Documentation

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

Definition at line 1220 of file GMPBase.py.

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

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

Definition at line 1175 of file GMPBase.py.

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

## Member Data Documentation

GaudiMP.GMPBase.Writer.currentEvent

Definition at line 1257 of file GMPBase.py.

GaudiMP.GMPBase.Writer.filerecordsAgent

Definition at line 1231 of file GMPBase.py.

GaudiMP.GMPBase.Writer.histoAgent

Definition at line 1230 of file GMPBase.py.

GaudiMP.GMPBase.Writer.status

Definition at line 1172 of file GMPBase.py.

GaudiMP.GMPBase.Writer.writerDict

Definition at line 1170 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py