The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
GaudiMP.GMPBase.Writer Class Reference
Inheritance diagram for GaudiMP.GMPBase.Writer:
Collaboration diagram for GaudiMP.GMPBase.Writer:

Public Member Functions

 __init__ (self, queues, events, params, subworkers)
 processConfiguration (self)
 Engine (self)
Public Member Functions inherited from GaudiMP.GMPBase.GMPComponent
 __init__ (self, nodeType, nodeID, queues, events, params, subworkers)
 Start (self)
 SetupGaudiPython (self)
 StartGaudiPython (self)
 LoadTES (self, tbufferfile)
 getEventNumber (self)
 IdentifyWriters (self)
 dumpHistograms (self)
 Initialize (self)
 Finalize (self)
 Report (self)

Public Attributes

 writerDict = self.IdentifyWriters()
list status = [False] * self.nWorkers
 histoAgent = HistoAgent(self)
 filerecordsAgent = FileRecordsAgent(self)
Public Attributes inherited from GaudiMP.GMPBase.GMPComponent
str nodeType = nodeType
 initEvent
 finalEvent = events
 eventLoopSyncer
 lastEvent = eventLoopSyncer
 nWorkers
 sEvent
 config
 log = params
 subworkers = subworkers
int nodeID = nodeID
 msgFormat = self.config["MessageSvc"].Format
 currentEvent = None
 queues = queues
int num = 0
str app = None
 evcom = EventCommunicator(self, qin, qout)
list evcoms = []
 hq = histq
 fq = fq
int nIn = 0
int nOut = 0
 stat = SUCCESS
float iTime = 0.0
float rTime = 0.0
float fTime = 0.0
float firstEvTime = 0.0
float tTime = 0.0
 proc = Process(target=self.Engine)
 a = AppMgr()
 evt = self.a.evtsvc()
 hvt = self.a.histsvc()
 fsr = self.a.filerecordsvc()
 inc = self.a.service("IncidentSvc", "IIncidentSvc")
 pers = self.a.service("EventPersistencySvc", "IAddressCreator")
 ts = gbl.GaudiMP.TESSerializer(self.evt._idp, self.pers)
 TS = TESSerializer(self.ts, self.evt, self.nodeType, self.nodeID, self.log)
 cntr = InterfaceCast(gbl.IEventCounter)(tool.getInterface())

Detailed Description

Definition at line 1236 of file GMPBase.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1237 of file GMPBase.py.

1237 def __init__(self, queues, events, params, subworkers):
1238 GMPComponent.__init__(self, "Writer", -2, queues, events, params, subworkers)
1239 # Identify the writer streams
1240 self.writerDict = self.IdentifyWriters()
1241 # This keeps track of workers as they finish
1242 self.status = [False] * self.nWorkers
1243 self.log.name = "Writer--2"
1244

Member Function Documentation

◆ Engine()

GaudiMP.GMPBase.Writer.Engine ( self)

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 1254 of file GMPBase.py.

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

◆ processConfiguration()

GaudiMP.GMPBase.Writer.processConfiguration ( self)

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 1245 of file GMPBase.py.

1245 def processConfiguration(self):
1246 # Writer :
1247 # No input
1248 # No Algs
1249 self.config["ApplicationMgr"].TopAlg = []
1250 self.config["EventSelector"].Input = []
1251
1252 self.config["MessageSvc"].Format = "[Writer] " + self.msgFormat
1253

Member Data Documentation

◆ filerecordsAgent

GaudiMP.GMPBase.Writer.filerecordsAgent = FileRecordsAgent(self)

Definition at line 1264 of file GMPBase.py.

◆ histoAgent

GaudiMP.GMPBase.Writer.histoAgent = HistoAgent(self)

Definition at line 1263 of file GMPBase.py.

◆ status

GaudiMP.GMPBase.Writer.status = [False] * self.nWorkers

Definition at line 1242 of file GMPBase.py.

◆ writerDict

GaudiMP.GMPBase.Writer.writerDict = self.IdentifyWriters()

Definition at line 1240 of file GMPBase.py.


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