| The Gaudi Framework v32r1 (f65d50dc)

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 | 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
| msgFormat
| 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 1213 of file GMPBase.py.

## Constructor & Destructor Documentation

## ◆ __init__()

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

Definition at line 1214 of file GMPBase.py.

1214 def __init__(self, queues, events, params, subworkers):
1215 GMPComponent.__init__(self, 'Writer', -2, queues, events, params,
1216 subworkers)
1217 # Identify the writer streams
1218 self.writerDict = self.IdentifyWriters()
1219 # This keeps track of workers as they finish
1220 self.status = [False] * self.nWorkers
1221 self.log.name = "Writer--2"
1222

## Member Function Documentation

## ◆ Engine()

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

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 1269 of file GMPBase.py.

1269 def Engine(self):
1270 # rename process
1271 import os
1272 import ctypes
1273 libc = ctypes.CDLL('libc.so.6')
1274 name = str(self.nodeType) + str(self.nodeID) + '\0'
1275 libc.prctl(15, name, 0, 0, 0)
1276
1277 startEngine = time.time()
1278 self.Initialize()
1279 self.histoAgent = HistoAgent(self)
1280 self.filerecordsAgent = FileRecordsAgent(self)
1281
1282 # Begin processing
1283 Go = True
1284 current = -1
1285 stopCriteria = self.nWorkers
1286 while Go:
1287 current = (current + 1) % self.nWorkers
1288 packet = self.evcoms[current].receive(timeout=0.01)
1289 if packet == None:
1290 continue
1291 if packet == 'FINISHED':
1292 self.log.info(
1293 'Writer got FINISHED flag : Worker %i' % (current))
1294
1295 self.status[current] = True
1296 if all(self.status):
1297 self.log.info('FINISHED recd from all workers, break loop')
1298 break
1299 continue
1300 # otherwise, continue as normal
1301 self.nIn += 1 # update central count (maybe needed by FSR store)
1302 evtNumber, tbin = packet # unpack
1303 self.TS.Load(tbin)
1304 t = time.time()
1305 self.a.executeEvent()
1306 self.rTime += (time.time() - t)
1307 self.currentEvent = self.getEventNumber()
1308 self.evt.clearStore()
1309 self.eventLoopSyncer.set()
1310 self.log.name = "Writer--2"
1311 self.log.info('Setting <Last> Event')
1312 self.lastEvent.set()
1313
1314 # finalisation steps
1315 [e.finalize() for e in self.evcoms]
1316 # Now do Histograms
1317 sc = self.histoAgent.Receive()
1318 sc = self.histoAgent.RebuildHistoStore()
1319 if sc.isSuccess():
1320 self.log.info('Histo Store rebuilt ok')
1321 else:
1322 self.log.warning('Histo Store Error in Rebuild')
1323
1324 # Now do FileRecords
1325 sc = self.filerecordsAgent.Receive()
1326 self.filerecordsAgent.Rebuild()
1327 self.Finalize()
1328 #self.rTime = time.time()-startEngine
1329 self.Report()
1330
1331
1332 # =============================================================================
1333
1334 # =============================================================================
1335
1336

## ◆ processConfiguration()

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

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 1223 of file GMPBase.py.

1223 def processConfiguration(self):
1224 # Writer :
1225 # No input
1226 # No Algs
1227 self.config['ApplicationMgr'].TopAlg = []
1228 self.config['EventSelector'].Input = []
1229
1230 self.config['MessageSvc'].Format = '%-13s ' % '[Writer]' + \
1231 self.msgFormat
1232
1233 # Now process the output writers
1234 for key, lst in self.writerDict.iteritems():
1235 self.log.info('Writer Type : %s\t : %i' % (key, len(lst)))
1236
1237 # Modify the name of the output file to reflect that it came
1238 # from a parallel processing
1239 #
1240 # Event Writers
1241 for m in self.writerDict["events"]:
1242 self.log.debug('Processing Event Writer : %s' % (m))
1243 newName = m.getNewName('.', '.p%i.' % self.nWorkers)
1244 self.config[m.key].Output = newName
1245
1246 # Now, if there are no event writers, the FileRecords file
1247 # will fail to open, as it only opens an UPDATE version
1248 # of the existing Event Output File
1249 # So, if there are no event writers, edit the string of the
1250 # FileRecord Writer
1251
1252 # FileRecords Writers
1253 for m in self.writerDict["records"]:
1254 self.log.debug('Processing FileRecords Writer: %s' % (m))
1255 newName = m.getNewName(
1256 '.', '.p%i.' % self.nWorkers, extra=" OPT='RECREATE'")
1257 self.config[m.key].Output = newName
1258
1259 # same for histos
1260 hs = "HistogramPersistencySvc"
1261 n = None
1262 if hs in self.config.keys():
1263 n = self.config[hs].OutputFile
1264 if n:
1265 newName = self.config[hs].OutputFile.replace(
1266 '.', '.p%i.' % (self.nWorkers))
1267 self.config[hs].OutputFile = newName
1268

## Member Data Documentation

## ◆ currentEvent

GaudiMP.GMPBase.Writer.currentEvent

Definition at line 1307 of file GMPBase.py.

## ◆ filerecordsAgent

GaudiMP.GMPBase.Writer.filerecordsAgent

Definition at line 1280 of file GMPBase.py.

## ◆ histoAgent

GaudiMP.GMPBase.Writer.histoAgent

Definition at line 1279 of file GMPBase.py.

## ◆ status

GaudiMP.GMPBase.Writer.status

Definition at line 1220 of file GMPBase.py.

## ◆ writerDict

GaudiMP.GMPBase.Writer.writerDict

Definition at line 1218 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py