Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Gaudi.Configuration Namespace Reference

Classes

class  GaudiPersistency
 

Functions

def _fillConfDict ()
 
def importConfiguration (conf, local=locals())
 
def configurationDict (all=False)
 
def getConfigurable (name, defaultType=None)
 
def setCustomMainLoop (runner)
 

Variables

 log = logging.getLogger(__name__)
 
 allConfigurables = Configurable.allConfigurables
 

Function Documentation

def Gaudi.Configuration._fillConfDict ( )
private

Definition at line 20 of file Configuration.py.

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
48 
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 
getNeededConfigurables
Definition: Proxy.py:21
def configurationDict(all=False)
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 
def getConfigurable(name, defaultType=None)
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 
def importConfiguration(conf, local=locals())
def Gaudi.Configuration.setCustomMainLoop (   runner)
Replace the default main execution loop with the specified callable object.

@param runner: a callable that accepts an initialized instance of GaudiPython.AppMgr
               and the number of events to process and returns a StatusCode or a boolean
               (True means success)

Definition at line 113 of file Configuration.py.

113 def setCustomMainLoop(runner):
114  '''
115  Replace the default main execution loop with the specified callable object.
116 
117  @param runner: a callable that accepts an initialized instance of GaudiPython.AppMgr
118  and the number of events to process and returns a StatusCode or a boolean
119  (True means success)
120  '''
121  # change the mainLoop function
122  from Gaudi.Main import gaudimain
123  gaudimain.mainLoop = lambda _self, app, nevt: runner(app, nevt)
124 
125 
def setCustomMainLoop(runner)

Variable Documentation

Gaudi.Configuration.allConfigurables = Configurable.allConfigurables

Definition at line 17 of file Configuration.py.

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

Definition at line 13 of file Configuration.py.