| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Functions | Variables
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 19 of file Configuration.py.

19 def _fillConfDict():
20 nFiles = loadConfigurableDb()
21 log = logging.getLogger( 'PropertyProxy' )
22 log.debug( "Read module info for %d configurables from %d genConfDb files",
23 len(cfgDb), nFiles )
24 if len(cfgDb.duplicates()) > 0:
25 log.warning( "Found %d duplicates among the %d genConfDb files :",
26 len(cfgDb.duplicates()), nFiles )
27 log.warning( "--------------------------------------------------" )
28 log.warning( " -%s: %s - %s",
29 "<component name>", "<module>", "[ <duplicates> ]" )
30 log.warning( "--------------------------------------------------" )
31 dups = cfgDb.duplicates()
32 for cfgName in dups.keys():
33 log.warning( " -%s: %s - %s",
34 cfgName,
35 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 # fill the configurable dictionary at module load
47 _fillConfDict()
48
GaudiKernel.ConfigurableDb.loadConfigurableDb
def loadConfigurableDb()
Helper function to load all ConfigurableDb files holding informations.
Definition: ConfigurableDb.py:106
Gaudi.Configuration._fillConfDict
def _fillConfDict()
Definition: Configuration.py:19

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

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

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

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

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

Definition at line 51 of file Configuration.py.

51 def importConfiguration(conf, local=locals()) :
52 local[conf] = confDbGetConfigurable(conf)
53
Gaudi.Configuration.importConfiguration
def importConfiguration(conf, local=locals())
Definition: Configuration.py:51

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

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

## 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.