The Gaudi Framework  v38r1p1 (ae26267b)
Gaudi.Configuration Namespace Reference

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

36 def _fillConfDict():
37  nFiles = loadConfigurableDb()
38  log = logging.getLogger("PropertyProxy")
39  log.debug(
40  "Read module info for %d configurables from %d genConfDb files",
41  len(cfgDb),
42  nFiles,
43  )
44  if len(cfgDb.duplicates()) > 0:
45  log.warning(
46  "Found %d duplicates among the %d genConfDb files :",
47  len(cfgDb.duplicates()),
48  nFiles,
49  )
50  log.warning("--------------------------------------------------")
51  log.warning(
52  " -%s: %s - %s", "<component name>", "<module>", "[ <duplicates> ]"
53  )
54  log.warning("--------------------------------------------------")
55  dups = cfgDb.duplicates()
56  for cfgName in dups.keys():
57  log.warning(
58  " -%s: %s - %s",
59  cfgName,
60  cfgDb[cfgName]["module"],
61  str([d["module"] for d in dups[cfgName]]),
62  )
63  pass
64  del dups
65  pass
66  else:
67  log.debug("No duplicates have been found: that's good !")
68  pass
69  return
70 
71 
72 # fill the configurable dictionary at module load
74 
75 

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

80 def configurationDict(all=False):
81  """Return a dictionary representing the configuration.
82  The dictionary contains one entry per configurable which is a dictionary
83  with one entry per property.
84  The optional argument "all" is used to decide if to include only values
85  different from the default or all of them.
86  """
87  from GaudiKernel.Proxy.Configurable import getNeededConfigurables
88 
89  catalog = allConfigurables
90  keys = getNeededConfigurables() # use only interesting configurables
91  conf_dict = {}
92  if all:
93  for n in keys:
94  if n not in conf_dict:
95  conf_dict[n] = {}
96  for p, v in catalog[n].getDefaultProperties().items():
97  conf_dict[n][p] = v
98 
99  for n in keys:
100  if n not in conf_dict:
101  conf_dict[n] = {}
102  for p, v in catalog[n].getValuedProperties().items():
103  conf_dict[n][p] = v
104  # purge empty configurables
105  keys = conf_dict.keys()
106  ret_dict = {}
107  for n in keys:
108  if conf_dict[n]:
109  ret_dict[n] = conf_dict[n]
110  return ret_dict
111 
112 

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

113 def getConfigurable(name, defaultType=None):
114  """Helper function to get a configurable with the given name regardless
115  for the type.
116  If defaultType can be a class derived from configurable or a string. If not
117  specified, the tool name is used as type."""
118  if name in allConfigurables:
119  return allConfigurables[name]
120  else:
121  # if the configurable is not found, we need to instantiate it
122  if defaultType is None:
123  # try to use the name of the configurable as default type
124  defaultType = name
125  if type(defaultType) is str:
126  # we need to convert from string to actual class
127  if defaultType in globals():
128  # We the type is defined in the global namespace
129  defaultType = globals()[defaultType]
130  else:
131  # otherwise we try to get it from the Configurables database
132  import Configurables
133 
134  defaultType = getattr(Configurables, defaultType)
135  return defaultType(name)

◆ importConfiguration()

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

Definition at line 76 of file Configuration.py.

76 def importConfiguration(conf, local=locals()):
77  local[conf] = confDbGetConfigurable(conf)
78 
79 

Variable Documentation

◆ allConfigurables

Gaudi.Configuration.allConfigurables = Configurable.allConfigurables

Definition at line 33 of file Configuration.py.

◆ log

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

Definition at line 29 of file Configuration.py.

Gaudi.Configuration.configurationDict
def configurationDict(all=False)
Definition: Configuration.py:80
GaudiKernel.Proxy.getNeededConfigurables
getNeededConfigurables
Definition: Proxy.py:30
GaudiKernel.ConfigurableDb.loadConfigurableDb
def loadConfigurableDb()
Definition: ConfigurableDb.py:113
Gaudi.Configuration.importConfiguration
def importConfiguration(conf, local=locals())
Definition: Configuration.py:76
Gaudi.Configuration.getConfigurable
def getConfigurable(name, defaultType=None)
Definition: Configuration.py:113
gaudirun.type
type
Definition: gaudirun.py:160
Gaudi.Configuration._fillConfDict
def _fillConfDict()
Definition: Configuration.py:36