| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# Gaudi::Configuration Namespace Reference

## Functions
def | _fillConfDict
def | importConfiguration
def | configurationDict
def | getConfigurable
## Variables
tuple | log = logging.getLogger(__name__)
| allConfigurables = Configurable.allConfigurables

## Function Documentation

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::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 54 of file Configuration.py.

    00054                                 :
    00055     """Return a dictionary representing the configuration.
    00056     The dictionary contains one entry per configurable which is a dictionary
    00057     with one entry per property.
    00058     The optional argument "all" is used to decide if to inluce only values
    00059     different from the default or all of them.
    00060     """
    00061     from GaudiKernel.Proxy.Configurable import getNeededConfigurables
    00062
    00063     catalog = allConfigurables
    00064     keys = getNeededConfigurables() # use only interesting configurables
    00065     conf_dict = {}
    00066     if all:
    00067         for n in keys :
    00068             if n not in conf_dict:
    00069                 conf_dict[n] = {}
    00070             for p, v in  catalog[n].getDefaultProperties().items() :
    00071                 conf_dict[n][p] = v
    00072
    00073     for n in keys :
    00074         if n not in conf_dict:
    00075             conf_dict[n] = {}
    00076         for p, v in catalog[n].getValuedProperties().items() :
    00077             conf_dict[n][p] = v
    00078     # purge empty configurables
    00079     keys = conf_dict.keys()
    00080     for n in keys:
    00081         if not conf_dict[n]:
    00082             del conf_dict[n]
    00083     return conf_dict
    00084
    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 85 of file Configuration.py.

    00085                                              :
    00086     """Helper function to get a configurable with the given name regardless
    00087     for the type.
    00088     If defaultType can be a class derived from configurable or a string. If not
    00089     specified, the tool name is used as type."""
    00090     if name in allConfigurables:
    00091         return allConfigurables[name]
    00092     else:
    00093         # if the configurable is not found, we need to instantiate it
    00094         if defaultType is None:
    00095             # try to use the name of the configurable as default type
    00096             defaultType = name
    00097         if type(defaultType) is str:
    00098             # we need to convert from string to actual class
    00099             if defaultType in globals():
    00100                 # We the type is defined in the global namespace
    00101                 defaultType = globals()[defaultType]
    00102             else:
    00103                 # otherwise we try to get it from the Configurables database
    00104                 defaultType = getattr(Configurables, defaultType)
    00105         return defaultType(name)
            return defaultType(name)

def Gaudi::Configuration::importConfiguration | ( |  | conf,
|  |  | local = `locals()` |
| ) |  |  |

Definition at line 51 of file Configuration.py.

    00051                                               :
    00052     local[conf] = confDbGetConfigurable(conf)
    00053
    def configurationDict(all=False):

## Variable Documentation

Gaudi::Configuration::allConfigurables = Configurable.allConfigurables

Definition at line 17 of file Configuration.py.

tuple Gaudi::Configuration::log = logging.getLogger(__name__)

Definition at line 13 of file Configuration.py.