| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions | Public Attributes

# GaudiMP::GMPBase::GMPComponent Class Reference

Inheritance diagram for GaudiMP::GMPBase::GMPComponent:
[legend]

List of all members.

## Public Member Functions
def | __init__
def | Start
def | Engine
def | processConfiguration
def | SetupGaudiPython
def | StartGaudiPython
def | LoadTES
def | getEventNumber
def | IdentifyWriters
def | dumpHistograms
def | Initialize
def | Finalize
def | Report
## Public Attributes
| nodeType
| finalEvent
| lastEvent
| log
| nodeID
| currentEvent
| evcom
| evcoms
| hq
| fq
| nIn
| nOut
| stat
| iTime
| rTime
| fTime
| firstEvTime
| tTime
| proc
| a
| evt
| hvt
| fsr
| inc
| pers
| ts
| TS

## Detailed Description

Definition at line 389 of file GMPBase.py.

## Constructor & Destructor Documentation

def GaudiMP::GMPBase::GMPComponent::__init__ | ( |  | self,
|  |  | nodeType,
|  |  | nodeID,
|  |  | queues,
|  |  | events,
|  |  | params
| ) |  |

Definition at line 396 of file GMPBase.py.

    00397                                                                     :
    00398         # declare a Gaudi MultiProcessing Node
    00399         # the nodeType is going to be one of Reader, Worker, Writer
    00400         # qPair is going to be a tuple of ( qin, qout )
    00401         # for sending and receiving
    00402         # if nodeType is "Writer", it will be a list of qPairs,
    00403         # as there's one queue-in from each Worker
    00404         #
    00405         # params is a tuple of (nWorkers, config, log)
    00406
    00407         self.nodeType = nodeType
    00408         current_process().name = nodeType
    00409
    00410         # Synchronisation Event() objects for keeping track of the system
    00411         self.initEvent, eventLoopSyncer, self.finalEvent = events
    00412         self.eventLoopSyncer, self.lastEvent = eventLoopSyncer   # unpack tuple
    00413
    00414         # necessary for knowledge of the system
    00415         self.nWorkers, self.sEvent, self.config, self.log = params
    00416         self.nodeID   = nodeID
    00417
    00418         # describe the state of the node by the current Event Number
    00419         self.currentEvent = None
    00420
    00421         # Unpack the Queues : (events, histos, filerecords)
    00422         qPair, histq, fq = queues
    00423
    00424         # Set up the Queue Mechanisms ( Event Communicators )
    00425         if self.nodeType == 'Reader' or self.nodeType == 'Worker' :
    00426             # Reader or Worker Node
    00427             qin, qout = qPair
    00428             self.evcom = EventCommunicator( self, qin, qout )
    00429         else :
    00430             # Writer : many queues in, no queue out
    00431             assert self.nodeType == 'Writer'
    00432             self.evcoms = []
    00433             qsin = qPair[0]
    00434             for q in qsin :
    00435                 ec = EventCommunicator( self, q, None )
    00436                 self.evcoms.append( ec )
    00437         # Histogram Queue
    00438         self.hq = histq
    00439         # FileRecords Queue
    00440         self.fq = fq
    00441
    00442         # Universal Counters (available to all nodes)
    00443         # Use sensibly!!!
    00444         self.nIn  = 0
    00445         self.nOut = 0
    00446
    00447         # Status Flag (possibly remove later)
    00448         self.stat = SUCCESS
    00449
    00450         # Set logger name
    00451         self.log.name = '%s-%i'%(self.nodeType, self.nodeID)
    00452
    00453         # Heuristic variables
    00454         # time for init, run, final, firstEventTime, totalTime
    00455         self.iTime       = 0.0
    00456         self.rTime       = 0.0
    00457         self.fTime       = 0.0
    00458         self.firstEvTime = 0.0
    00459         self.tTime       = 0.0
    00460
    00461         # define the separate process
    00462         self.proc = Process( target=self.Engine )

## Member Function Documentation

def GaudiMP::GMPBase::GMPComponent::dumpHistograms | ( |  | self ) |

    Method used by the GaudiPython algorithm CollectHistos
    to obtain a dictionary of form { path : object }
    representing the Histogram Store

Definition at line 562 of file GMPBase.py.

    00563                                :
    00564         '''
    00565         Method used by the GaudiPython algorithm CollectHistos
    00566         to obtain a dictionary of form { path : object }
    00567         representing the Histogram Store
    00568         '''
    00569         nlist = self.hvt.getHistoNames( )
    00570         histDict = {}
    00571         objects = 0 ; histos = 0
    00572         if nlist :
    00573             for n in nlist :
    00574                 o = self.hvt[ n ]
    00575                 if type(o) in aidatypes :
    00576                     o = aida2root(o)
    00577                     histos  += 1
    00578                 else :
    00579                     objects += 1
    00580                 histDict[ n ] = o
    00581         else :
    00582             print 'WARNING : no histograms to recover?'
    00583         return histDict

def GaudiMP::GMPBase::GMPComponent::Engine | ( |  | self ) |

Reimplemented in GaudiMP::GMPBase::Reader, GaudiMP::GMPBase::Worker, and GaudiMP::GMPBase::Writer.

Definition at line 467 of file GMPBase.py.

    00468                        :
    00469         # This will be the method carried out by the Node
    00470         # Different for all
    00471         pass

def GaudiMP::GMPBase::GMPComponent::Finalize | ( |  | self ) |

Definition at line 593 of file GMPBase.py.

    00594                          :
    00595         start = time.time()
    00596         self.a.stop()
    00597         self.a.finalize()
    00598         self.log.info( '%s-%i Finalized'%(self.nodeType, self.nodeID) )
    00599         self.finalEvent.set()
    00600         self.fTime = time.time() - start

def GaudiMP::GMPBase::GMPComponent::getEventNumber | ( |  | self ) |

Definition at line 506 of file GMPBase.py.

    00507                                :
    00508         # Using getList or getHistoNames can result in the EventSelector
    00509         # re-initialising connection to RootDBase, which costs a lot of
    00510         # time... try to build a set of Header paths??
    00511
    00512         # First Attempt : Unpacked Event Data
    00513         lst = [ '/Event/Gen/Header',
    00514                 '/Event/Rec/Header' ]
    00515         for l in lst :
    00516             path = l
    00517             try :
    00518                 n = self.evt[path].evtNumber()
    00519                 return n
    00520             except :
    00521                 # No evt number at this path
    00522                 continue
    00523
    00524         # second attepmt : try DAQ/RawEvent data
    00525         # The Evt Number is in bank type 16, bank 0, data pt 4
    00526         try :
    00527             n = self.evt['/Event/DAQ/RawEvent'].banks(16)[0].data()[4]
    00528             return n
    00529         except :
    00530             pass
    00531
    00532         # Default Action
    00533         if self.nIn > 0 or self.nOut > 0 :
    00534             pass
    00535         else :
    00536             self.log.warning('Could not determine Event Number')
    00537         return -1

def GaudiMP::GMPBase::GMPComponent::IdentifyWriters | ( |  | self ) |

Definition at line 538 of file GMPBase.py.

    00539                                 :
    00540         #
    00541         # Identify Writers in the Configuration
    00542         #
    00543         d = {}
    00544         keys = [ "events", "records", "tuples", "histos" ]
    00545         for k in keys :
    00546             d[k] = []
    00547
    00548         # Identify Writers and Classify
    00549         wkeys = WRITERTYPES.keys()
    00550         for v in self.config.values() :
    00551             if v.__class__.__name__ in wkeys :
    00552                 writerType = WRITERTYPES[ v.__class__.__name__ ]
    00553                 d[writerType].append( MiniWriter(v, writerType, self.config) )
    00554                 if self.nodeID == 0 :
    00555                     self.log.info('Writer Found : %s'%(v.name()))
    00556
    00557         # Now Check for the Histogram Service
    00558         if 'HistogramPersistencySvc' in  self.config.keys() :
    00559             hfile =self.config['HistogramPersistencySvc'].getProp('OutputFile')
    00560             d[ "histos" ].append( hfile )
    00561         return d

def GaudiMP::GMPBase::GMPComponent::Initialize | ( |  | self ) |

Definition at line 584 of file GMPBase.py.

    00585                            :
    00586         start = time.time()
    00587         self.processConfiguration( )
    00588         self.SetupGaudiPython( )
    00589         # Set the initialisation flag!
    00590         self.initEvent.set()
    00591         self.StartGaudiPython( )
    00592         self.iTime = time.time() - start

def GaudiMP::GMPBase::GMPComponent::LoadTES | ( |  | self,
|  |  | tbufferfile
| ) |  |

Definition at line 500 of file GMPBase.py.

    00501                                      :
    00502         root = gbl.DataObject()
    00503         setOwnership(root, False)
    00504         self.evt.setRoot( '/Event', root )
    00505         self.ts.loadBuffer(tbufferfile)

def GaudiMP::GMPBase::GMPComponent::processConfiguration | ( |  | self ) |

Reimplemented in GaudiMP::GMPBase::Reader, GaudiMP::GMPBase::Worker, and GaudiMP::GMPBase::Writer.

Definition at line 472 of file GMPBase.py.

    00473                                      :
    00474         # Different for all ; customize Configuration for multicore
    00475         pass

def GaudiMP::GMPBase::GMPComponent::Report | ( |  | self ) |

Definition at line 601 of file GMPBase.py.

    00602                        :
    00603         self.log.name = "%s-%i Audit"%(self.nodeType, self.nodeID)
    00604         allTime  = "Alive Time     : %5.2f"%(self.tTime)
    00605         initTime = "Init Time      : %5.2f"%(self.iTime)
    00606         frstTime = "1st Event Time : %5.2f"%(self.firstEvTime)
    00607         runTime  = "Run Time       : %5.2f"%(self.rTime)
    00608         finTime  = "Finalise Time  : %5.2f"%(self.fTime)
    00609         tup = ( allTime, initTime, frstTime, runTime, finTime )
    00610         for t in tup :
    00611             self.log.info( t )
    00612         self.log.name = "%s-%i"%(self.nodeType, self.nodeID)
    00613         # and report from the TESSerializer
    00614         self.TS.Report()
    00615
    00616 # =============================================================================

def GaudiMP::GMPBase::GMPComponent::SetupGaudiPython | ( |  | self ) |

Definition at line 476 of file GMPBase.py.

    00477                                  :
    00478         # This method will initialize the GaudiPython Tools
    00479         # such as the AppMgr and so on
    00480         self.a   = AppMgr()
    00481         if SMAPS :
    00482             from AlgSmapShot import SmapShot
    00483             smapsLog = self.nodeType+'-'+str(self.nodeID)+'.smp'
    00484             ss = SmapShot( logname=smapsLog )
    00485             self.a.addAlgorithm( ss )
    00486         self.evt = self.a.evtsvc()
    00487         self.hvt = self.a.histsvc()
    00488         self.fsr = self.a.filerecordsvc()
    00489         self.inc = self.a.service('IncidentSvc','IIncidentSvc')
    00490         self.pers = self.a.service( 'EventPersistencySvc', 'IAddressCreator' )
    00491         self.ts  = gbl.GaudiMP.TESSerializer( self.evt._idp, self.pers )
    00492         self.TS  = TESSerializer( self.ts, self.evt,
    00493                                   self.nodeType, self.nodeID, self.log )
    00494         return SUCCESS

def GaudiMP::GMPBase::GMPComponent::Start | ( |  | self ) |

Definition at line 463 of file GMPBase.py.

    00464                       :
    00465         # Fork and start the separate process
    00466         self.proc.start()

def GaudiMP::GMPBase::GMPComponent::StartGaudiPython | ( |  | self ) |

Definition at line 495 of file GMPBase.py.

    00496                                  :
    00497         self.a.initialize()
    00498         self.a.start()
    00499         return SUCCESS

## Member Data Documentation

GaudiMP::GMPBase::GMPComponent::a

Definition at line 476 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::currentEvent

Reimplemented in GaudiMP::GMPBase::Reader, GaudiMP::GMPBase::Worker, and GaudiMP::GMPBase::Writer.

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::evcom

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::evcoms

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::evt

Definition at line 476 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::finalEvent

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::firstEvTime

Reimplemented in GaudiMP::GMPBase::Reader, and GaudiMP::GMPBase::Worker.

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::fq

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::fsr

Definition at line 476 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::fTime

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::hq

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::hvt

Definition at line 476 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::inc

Definition at line 476 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::iTime

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::lastEvent

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::log

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::nIn

Reimplemented in GaudiMP::GMPBase::Worker.

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::nodeID

Reimplemented in GaudiMP::GMPBase::Worker.

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::nodeType

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::nOut

Reimplemented in GaudiMP::GMPBase::Reader.

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::pers

Definition at line 476 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::proc

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::rTime

Reimplemented in GaudiMP::GMPBase::Writer.

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::stat

Reimplemented in GaudiMP::GMPBase::Reader.

Definition at line 396 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::TS

Definition at line 476 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::ts

Definition at line 476 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::tTime

Reimplemented in GaudiMP::GMPBase::Reader, and GaudiMP::GMPBase::Worker.

Definition at line 396 of file GMPBase.py.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiMP/python/GaudiMP/GMPBase.py

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines