| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# 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
| pers
| ts
| TS

## Detailed Description

Definition at line 389 of file GMPBase.py.

## Member Function 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 )

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

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

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

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

Definition at line 505 of file GMPBase.py.

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

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

Definition at line 537 of file GMPBase.py.

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

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

Definition at line 583 of file GMPBase.py.

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

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

Definition at line 499 of file GMPBase.py.

    00500                                      :
    00501         root = gbl.DataObject()
    00502         setOwnership(root, False)
    00503         self.evt.setRoot( '/Event', root )
    00504         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 600 of file GMPBase.py.

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

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.pers = self.a.service( 'EventPersistencySvc', 'IAddressCreator' )
    00490         self.ts  = gbl.GaudiPython.TESSerializer( self.evt._idp, self.pers )
    00491         self.TS  = TESSerializer( self.ts, self.evt,
    00492                                   self.nodeType, self.nodeID, self.log )
    00493         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 494 of file GMPBase.py.

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

## Member Data Documentation

GaudiMP::GMPBase::GMPComponent::a

Definition at line 479 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::currentEvent

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

Definition at line 418 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::evcom

Definition at line 427 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::evcoms

Definition at line 431 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::evt

Definition at line 485 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::finalEvent

Definition at line 410 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::firstEvTime

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

Definition at line 457 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::fq

Definition at line 439 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::fsr

Definition at line 487 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::fTime

Definition at line 456 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::hq

Definition at line 437 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::hvt

Definition at line 486 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::iTime

Definition at line 454 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::lastEvent

Definition at line 411 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::log

Definition at line 414 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::nIn

Reimplemented in GaudiMP::GMPBase::Worker.

Definition at line 443 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::nodeID

Reimplemented in GaudiMP::GMPBase::Worker.

Definition at line 415 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::nodeType

Definition at line 406 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::nOut

Reimplemented in GaudiMP::GMPBase::Reader.

Definition at line 444 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::pers

Definition at line 488 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::proc

Definition at line 461 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::rTime

Reimplemented in GaudiMP::GMPBase::Writer.

Definition at line 455 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::stat

Reimplemented in GaudiMP::GMPBase::Reader.

Definition at line 447 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::TS

Definition at line 490 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::ts

Definition at line 489 of file GMPBase.py.

GaudiMP::GMPBase::GMPComponent::tTime

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

Definition at line 458 of file GMPBase.py.

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

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

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