Classes | |
class | ConfFacade |
Functions | |
def | _fillConfDict |
def | importConfiguration |
def | configurationDict |
def | getConfigurable |
Variables | |
tuple | log = logging.getLogger("Gaudi.Configuration") |
allConfigurables = Configurable.allConfigurables |
def Gaudi::Configuration::_fillConfDict | ( | ) | [private] |
Definition at line 19 of file Configuration.py.
00019 : 00020 nFiles = loadConfigurableDb() 00021 log = logging.getLogger( 'PropertyProxy' ) 00022 log.debug( "Read module info for %d configurables from %d genConfDb files", 00023 len(cfgDb), nFiles ) 00024 if len(cfgDb.duplicates()) > 0: 00025 log.warning( "Found %d duplicates among the %d genConfDb files :", 00026 len(cfgDb.duplicates()), nFiles ) 00027 log.warning( "--------------------------------------------------" ) 00028 log.warning( " -%s: %s - %s", 00029 "<component name>", "<module>", "[ <duplicates> ]" ) 00030 log.warning( "--------------------------------------------------" ) 00031 dups = cfgDb.duplicates() 00032 for cfgName in dups.keys(): 00033 log.warning( " -%s: %s - %s", 00034 cfgName, 00035 cfgDb[cfgName]['module'], 00036 str([ d['module'] for d in dups[cfgName]]) ) 00037 pass 00038 del dups 00039 log.warning( "Fix your cmt/requirements file !!" ) 00040 pass 00041 else: 00042 log.debug( "No duplicates have been found: that's good !" ) 00043 pass 00044 return 00045 00046 # fill the configurable dictionary at module load 00047 _fillConfDict() 00048 import os, sys
def Gaudi::Configuration::importConfiguration | ( | conf, | ||
local = locals() | ||||
) |
Definition at line 51 of file Configuration.py.
00051 : 00052 local[conf] = confDbGetConfigurable(conf) 00053
def Gaudi::Configuration::configurationDict | ( | all = False |
) |
Return a dictionary representing the configuration. The dictionary contains one entry per configurable which is a dictionary with one entry per property. The optional argument "all" is used to decide if to inluce only values different from the default or all of them.
Definition at line 61 of file Configuration.py.
00061 : 00062 """Return a dictionary representing the configuration. 00063 The dictionary contains one entry per configurable which is a dictionary 00064 with one entry per property. 00065 The optional argument "all" is used to decide if to inluce only values 00066 different from the default or all of them. 00067 """ 00068 from GaudiKernel.Proxy.Configurable import getNeededConfigurables 00069 00070 catalog = allConfigurables 00071 keys = getNeededConfigurables() # use only interesting configurables 00072 conf_dict = {} 00073 if all: 00074 for n in keys : 00075 if n not in conf_dict: 00076 conf_dict[n] = {} 00077 for p, v in catalog[n].getDefaultProperties().items() : 00078 conf_dict[n][p] = v 00079 00080 for n in keys : 00081 if n not in conf_dict: 00082 conf_dict[n] = {} 00083 for p, v in catalog[n].getValuedProperties().items() : 00084 conf_dict[n][p] = v 00085 # purge empty configurables 00086 keys = conf_dict.keys() 00087 for n in keys: 00088 if not conf_dict[n]: 00089 del conf_dict[n] 00090 return conf_dict 00091 def getConfigurable(name, defaultType = None):
def Gaudi::Configuration::getConfigurable | ( | name, | ||
defaultType = None | ||||
) |
Helper function to get a configurable with the given name regardless for the type. If defaultType can be a class derived from configurable or a string. If not specified, the tool name is used as type.
Definition at line 92 of file Configuration.py.
00092 : 00093 """Helper function to get a configurable with the given name regardless 00094 for the type. 00095 If defaultType can be a class derived from configurable or a string. If not 00096 specified, the tool name is used as type.""" 00097 if name in allConfigurables: 00098 return allConfigurables[name] 00099 else: 00100 # if the configurable is not found, we need to instantiate it 00101 if defaultType is None: 00102 # try to use the name of the configurable as default type 00103 defaultType = name 00104 if type(defaultType) is str: 00105 # we need to convert from string to actual class 00106 if defaultType in globals(): 00107 # We the type is defined in the global namespace 00108 defaultType = globals()[defaultType] 00109 else: 00110 # otherwise we try to get it from the Configurables database 00111 exec "from Configurables import %s" % defaultType 00112 defaultType = locals()[defaultType] 00113 return defaultType(name) 00114 00115 sys.modules['Configurables'] = ConfFacade() sys.modules['Configurables'] = ConfFacade()
tuple Gaudi::Configuration::log = logging.getLogger("Gaudi.Configuration") [static] |
Definition at line 13 of file Configuration.py.
Definition at line 17 of file Configuration.py.