| The Gaudi Framework v29r0 (ff2e7097)

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

## Constructor & Destructor Documentation

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

Definition at line 1209 of file GMPBase.py.

1209 def __init__(self, queues, events, params, subworkers):
1210 GMPComponent.__init__(self, 'Writer', -2, queues,
1211 events, params, subworkers)
1212 # Identify the writer streams
1213 self.writerDict = self.IdentifyWriters()
1214 # This keeps track of workers as they finish
1215 self.status = [False] * self.nWorkers
1216 self.log.name = "Writer--2"
1217
GaudiMP.GMPBase.Writer.writerDict
writerDict
Definition: GMPBase.py:1213
GaudiMP.GMPBase.GMPComponent.IdentifyWriters
def IdentifyWriters(self)
Definition: GMPBase.py:580
GaudiMP.GMPBase.Writer.__init__
def __init__(self, queues, events, params, subworkers)
Definition: GMPBase.py:1209
GaudiMP.GMPBase.Writer.status
status
Definition: GMPBase.py:1215

## Member Function Documentation

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

Definition at line 1263 of file GMPBase.py.

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

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

Definition at line 1218 of file GMPBase.py.

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

## Member Data Documentation

GaudiMP.GMPBase.Writer.currentEvent

Definition at line 1301 of file GMPBase.py.

GaudiMP.GMPBase.Writer.filerecordsAgent

Definition at line 1274 of file GMPBase.py.

GaudiMP.GMPBase.Writer.histoAgent

Definition at line 1273 of file GMPBase.py.

GaudiMP.GMPBase.Writer.status

Definition at line 1215 of file GMPBase.py.

GaudiMP.GMPBase.Writer.writerDict

Definition at line 1213 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py