| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Functions | Variables
GaudiKernel.ConfigurableDb Namespace Reference

## Classes
class | _CfgDb
class | _Singleton

## Functions
def | loadConfigurableDb ()
| Helper function to load all ConfigurableDb files holding informations. More...
def | getConfigurable (className, requester='', assumeCxxClass=True)

## Variables
list | __all__ = [ 'CfgDb', 'cfgDb', 'loadConfigurableDb', 'getConfigurable' ]
| _transtable = string.maketrans('<>&*,: ().', '__rp__s___')
| log = logging.getLogger( 'ConfigurableDb' )
| CfgDb = _Singleton()
| cfgDb = CfgDb()
| default name for CfgDb instance More...

## Function Documentation

def GaudiKernel.ConfigurableDb.getConfigurable | ( |  | className,
|  |  | requester = `''`,
|  |  | assumeCxxClass = `True`
| ) |  |

Definition at line 145 of file ConfigurableDb.py.

145 def getConfigurable( className, requester='', assumeCxxClass=True ):
146 confClass=className
147 if assumeCxxClass:
148 # assume className is C++: --> translate to python
149 confClass = string.translate( confClass, _transtable )
150 # see if I have it in my dictionary
151 confClassInfo = cfgDb.get(confClass)
152 if not confClassInfo:
153 confClassInfo = cfgDb.get(confClass)
154 # get the python module
155 confMod = confClassInfo and confClassInfo.get('module')
156 if not confMod:
157 log.warning( "%s: Class %s not in database", requester, className )
158 return None
159 # load the module
160 try:
161 mod = __import__(confMod,globals(),locals(),confClass)
162 except ImportError:
163 log.warning( "%s: Module %s not found (needed for configurable %s)",
164 requester, confMod, className )
165 return None
166 # get the class
167 try:
168 confClass = getattr(mod,confClass)
169 except AttributeError:
170 log.warning( "%s: Configurable %s not found in module %s",
171 requester, confClass, confMod )
172 return None
173 # Got it!
174 log.debug( "%s: Found configurable %s in module %s",
175 requester, confClass, confMod )
176
177 return confClass
178
GaudiKernel.ConfigurableDb.getConfigurable
def getConfigurable(className, requester='', assumeCxxClass=True)
Definition: ConfigurableDb.py:145

def GaudiKernel.ConfigurableDb.loadConfigurableDb | ( |  | ) |

Helper function to load all ConfigurableDb files holding informations.

    Helper function to load all ConfigurableDb files (modules) holding
    informations about Configurables

Definition at line 106 of file ConfigurableDb.py.

106 def loadConfigurableDb():
107 """Helper function to load all ConfigurableDb files (modules) holding
108 informations about Configurables
109 """
110 import os
111 import sys
112 from glob import glob
113 from os.path import join as path_join
114 log.debug( "loading confDb files..." )
115 nFiles = 0 # counter of imported files
116 pathlist = os.getenv("LD_LIBRARY_PATH", "").split(os.pathsep)
117 for path in pathlist:
118 if not os.path.isdir(path):
119 continue
120 log.debug( "walking in [%s]...", path )
121 confDbFiles = [f for f in [path_join(path, f) for f in os.listdir(path)
122 if f.endswith('.confdb')]
123 if os.path.isfile(f)]
124 # check if we use "*_merged.confdb"
125 mergedConfDbFiles = [f for f in confDbFiles
126 if f.endswith('_merged.confdb')]
127 if mergedConfDbFiles:
128 # use only the merged ones
129 confDbFiles = mergedConfDbFiles
130
131 for confDb in confDbFiles:
132 log.debug( "\t-loading [%s]...", confDb )
133 try:
134 cfgDb._loadModule( confDb )
135 except Exception, err:
136 log.warning( "Could not load file [%s] !", confDb )
137 log.warning( "Reason: %s", err )
138 nFiles += 1
139 log.debug( "loading confDb files... [DONE]" )
140 nPkgs = len( set([k['package'] for k in cfgDb.values()]) )
141 log.debug( "loaded %i confDb packages", nPkgs )
142 return nFiles
143
144
GaudiKernel.ConfigurableDb.loadConfigurableDb
def loadConfigurableDb()
Helper function to load all ConfigurableDb files holding informations.
Definition: ConfigurableDb.py:106

## Variable Documentation

list GaudiKernel.ConfigurableDb.__all__ = [ 'CfgDb', 'cfgDb', 'loadConfigurableDb', 'getConfigurable' ]
| private

Definition at line 10 of file ConfigurableDb.py.

GaudiKernel.ConfigurableDb._transtable = string.maketrans('<>&*,: ().', '__rp__s___')
| private

Definition at line 13 of file ConfigurableDb.py.

GaudiKernel.ConfigurableDb.CfgDb = _Singleton()

Definition at line 96 of file ConfigurableDb.py.

GaudiKernel.ConfigurableDb.cfgDb = CfgDb()

default name for CfgDb instance

Definition at line 103 of file ConfigurableDb.py.

GaudiKernel.ConfigurableDb.log = logging.getLogger( 'ConfigurableDb' )

Definition at line 16 of file ConfigurableDb.py.