The Gaudi Framework  v32r2 (46d42edc)
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 21 of file Configuration.py.

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

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

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

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

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

◆ importConfiguration()

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

Definition at line 54 of file Configuration.py.

54 def importConfiguration(conf, local=locals()):
55  local[conf] = confDbGetConfigurable(conf)
56 
57 
def importConfiguration(conf, local=locals())

Variable Documentation

◆ allConfigurables

Gaudi.Configuration.allConfigurables = Configurable.allConfigurables

Definition at line 18 of file Configuration.py.

◆ log

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

Definition at line 14 of file Configuration.py.