GaudiMP.GMPBase.Writer Class Reference
Inheritance diagram for GaudiMP.GMPBase.Writer:
Collaboration diagram for GaudiMP.GMPBase.Writer:

Public Member Functions

def __init__ (self, queues, events, params, subworkers)
 
def processConfiguration (self)
 
def Engine (self)
 
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)
 
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 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  def __init__( self, queues, events, params, subworkers ) :
1169  GMPComponent.__init__(self,'Writer', -2, queues, events, params, subworkers )
1170  # Identify the writer streams
1172  # This keeps track of workers as they finish
1173  self.status = [False]*self.nWorkers
1174  self.log.name = "Writer--2"
1175 
def __init__(self, queues, events, params, subworkers)
Definition: GMPBase.py:1168
def GaudiMP.GMPBase.Writer.__init__ (   self,
  queues,
  events,
  params,
  subworkers 
)

Definition at line 1168 of file GMPBase.py.

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

Member Function Documentation

def GaudiMP.GMPBase.Writer.Engine (   self)

Definition at line 1221 of file GMPBase.py.

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

Definition at line 1221 of file GMPBase.py.

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

Definition at line 1176 of file GMPBase.py.

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

Definition at line 1176 of file GMPBase.py.

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

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: