Gaudi.Configuration Namespace Reference

Classes

class  GaudiPersistency
 

Functions

def _fillConfDict ()
 
def importConfiguration
 
def configurationDict
 
def getConfigurable
 
def setCustomMainLoop (runner)
 

Variables

tuple 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",
30  "<component name>", "<module>", "[ <duplicates> ]" )
31  log.warning( "--------------------------------------------------" )
32  dups = cfgDb.duplicates()
33  for cfgName in dups.keys():
34  log.warning( " -%s: %s - %s",
35  cfgName,
36  cfgDb[cfgName]['module'],
37  str([ d['module'] for d in dups[cfgName]]) )
38  pass
39  del dups
40  log.warning( "Fix your cmt/requirements file !!" )
41  pass
42  else:
43  log.debug( "No duplicates have been found: that's good !" )
44  pass
45  return
46 
47 # fill the configurable dictionary at module load
49 
def loadConfigurableDb()
Helper function to load all ConfigurableDb files holding informations.
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 55 of file Configuration.py.

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

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

Definition at line 52 of file Configuration.py.

52 def importConfiguration(conf, local=locals()) :
53  local[conf] = confDbGetConfigurable(conf)
54 
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 109 of file Configuration.py.

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

Variable Documentation

Gaudi.Configuration.allConfigurables = Configurable.allConfigurables

Definition at line 18 of file Configuration.py.

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

Definition at line 14 of file Configuration.py.