| The Gaudi Framework v32r1 (f65d50dc)

Classes | Functions | Variables
Gaudi.Configuration Namespace Reference

## Classes
class | GaudiPersistency

## Functions
def | _fillConfDict ()
def | importConfiguration (conf, local=locals())
def | configurationDict (all=False)
def | getConfigurable (name, defaultType=None)

## Variables
| log = logging.getLogger(__name__)
| allConfigurables = Configurable.allConfigurables

## Function Documentation

## ◆ _fillConfDict()

def Gaudi.Configuration._fillConfDict | ( |  | ) |
| private

Definition at line 20 of file Configuration.py.

20 def _fillConfDict():
21 nFiles = loadConfigurableDb()
22 log = logging.getLogger('PropertyProxy')
23 log.debug("Read module info for %d configurables from %d genConfDb files",
24 len(cfgDb), nFiles)
25 if len(cfgDb.duplicates()) > 0:
26 log.warning("Found %d duplicates among the %d genConfDb files :",
27 len(cfgDb.duplicates()), nFiles)
28 log.warning("--------------------------------------------------")
29 log.warning(" -%s: %s - %s", "<component name>", "<module>",
30 "[ <duplicates> ]")
31 log.warning("--------------------------------------------------")
32 dups = cfgDb.duplicates()
33 for cfgName in dups.keys():
34 log.warning(" -%s: %s - %s", cfgName, cfgDb[cfgName]['module'],
35 str([d['module'] for d in dups[cfgName]]))
36 pass
37 del dups
38 log.warning("Fix your cmt/requirements file !!")
39 pass
40 else:
41 log.debug("No duplicates have been found: that's good !")
42 pass
43 return
44
45
46 # fill the configurable dictionary at module load
47 _fillConfDict()
48
GaudiKernel.ConfigurableDb.loadConfigurableDb
def loadConfigurableDb()
Definition: ConfigurableDb.py:109
Gaudi.Configuration._fillConfDict
def _fillConfDict()
Definition: Configuration.py:20

## ◆ configurationDict()

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 include only values
    different from the default or all of them.

Definition at line 57 of file Configuration.py.

57 def configurationDict(all=False):
58 """Return a dictionary representing the configuration.
59 The dictionary contains one entry per configurable which is a dictionary
60 with one entry per property.
61 The optional argument "all" is used to decide if to include only values
62 different from the default or all of them.
63 """
64 from GaudiKernel.Proxy.Configurable import getNeededConfigurables
65
66 catalog = allConfigurables
67 keys = getNeededConfigurables() # use only interesting configurables
68 conf_dict = {}
69 if all:
70 for n in keys:
71 if n not in conf_dict:
72 conf_dict[n] = {}
73 for p, v in catalog[n].getDefaultProperties().items():
74 conf_dict[n][p] = v
75
76 for n in keys:
77 if n not in conf_dict:
78 conf_dict[n] = {}
79 for p, v in catalog[n].getValuedProperties().items():
80 conf_dict[n][p] = v
81 # purge empty configurables
82 keys = conf_dict.keys()
83 for n in keys:
84 if not conf_dict[n]:
85 del conf_dict[n]
86 return conf_dict
87
88
GaudiKernel.Proxy.getNeededConfigurables
getNeededConfigurables
Definition: Proxy.py:21
Gaudi.Configuration.configurationDict
def configurationDict(all=False)
Definition: Configuration.py:57

## ◆ getConfigurable()

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

89 def getConfigurable(name, defaultType=None):
90 """Helper function to get a configurable with the given name regardless
91 for the type.
92 If defaultType can be a class derived from configurable or a string. If not
93 specified, the tool name is used as type."""
94 if name in allConfigurables:
95 return allConfigurables[name]
96 else:
97 # if the configurable is not found, we need to instantiate it
98 if defaultType is None:
99 # try to use the name of the configurable as default type
100 defaultType = name
101 if type(defaultType) is str:
102 # we need to convert from string to actual class
103 if defaultType in globals():
104 # We the type is defined in the global namespace
105 defaultType = globals()[defaultType]
106 else:
107 # otherwise we try to get it from the Configurables database
108 import Configurables
109 defaultType = getattr(Configurables, defaultType)
110 return defaultType(name)
111
112
Gaudi.Configuration.getConfigurable
def getConfigurable(name, defaultType=None)
Definition: Configuration.py:89
gaudirun.type
type
Definition: gaudirun.py:142

## ◆ importConfiguration()

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

Definition at line 53 of file Configuration.py.

53 def importConfiguration(conf, local=locals()):
54 local[conf] = confDbGetConfigurable(conf)
55
56
Gaudi.Configuration.importConfiguration
def importConfiguration(conf, local=locals())
Definition: Configuration.py:53

## Variable Documentation

## ◆ allConfigurables

Gaudi.Configuration.allConfigurables = Configurable.allConfigurables

Definition at line 17 of file Configuration.py.

## ◆ log

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

Definition at line 13 of file Configuration.py.