The Gaudi Framework  v36r1 (3e2fb5a8)
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 31 of file Configuration.py.

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

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

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

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

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

◆ importConfiguration()

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

Definition at line 64 of file Configuration.py.

64 def importConfiguration(conf, local=locals()):
65  local[conf] = confDbGetConfigurable(conf)
66 
67 

Variable Documentation

◆ allConfigurables

Gaudi.Configuration.allConfigurables = Configurable.allConfigurables

Definition at line 28 of file Configuration.py.

◆ log

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

Definition at line 24 of file Configuration.py.

Gaudi.Configuration.configurationDict
def configurationDict(all=False)
Definition: Configuration.py:68
GaudiKernel.Proxy.getNeededConfigurables
getNeededConfigurables
Definition: Proxy.py:31
GaudiKernel.ConfigurableDb.loadConfigurableDb
def loadConfigurableDb()
Definition: ConfigurableDb.py:119
Gaudi.Configuration.importConfiguration
def importConfiguration(conf, local=locals())
Definition: Configuration.py:64
Gaudi.Configuration.getConfigurable
def getConfigurable(name, defaultType=None)
Definition: Configuration.py:101
gaudirun.type
type
Definition: gaudirun.py:154
Gaudi.Configuration._fillConfDict
def _fillConfDict()
Definition: Configuration.py:31
GaudiPython.Pythonizations.items
items
Definition: Pythonizations.py:526