2 from GaudiKernel.GaudiHandles
import GaudiHandle
3 from AthenaConfiguration.ComponentFactory
import CompFactory
4 from AthenaCommon.Logging
import logging
7 """Attempts to load all default components (those that are not actually configured)"""
9 def __load(comp, prop):
10 descr = comp._descriptors[prop]
11 if descr.default.getType() ==
"":
14 childComp = CompFactory.getComp(descr.default.getType())(descr.default.getName())
15 comp._properties[prop] = childComp
19 msg=logging.getLogger(
'loadDefaultComps')
20 msg.warning(
"Default component %s can not be loaded", descr.default.typeAndName )
24 for propName,value
in comp._descriptors.items():
25 if propName
in comp._properties:
continue
26 if isinstance(value.default, GaudiHandle):
27 __load(comp, propName )
33 """Sets all handle keys explicitly"""
35 if isinstance(d, collections.abc.Sequence):
36 return [el
for el
in d]
41 for propName, value
in comp._descriptors.items():
42 if propName
in comp._properties:
continue
43 if "HandleKey" in value.cpp_type:
44 comp._properties[propName] = __getDefault(value.default)
47 """Read the Exec.*MessageComponents flags and modify output level of components
49 The specification of components uses python fnmatch library and resembles UNIX paths.
50 For instance an event algorithm MyAlgo/MyInstance would have following path:
51 MasterSeq/AthAllAlgSeq/AthAlgSeq/MyAlgo/MyInstance
52 A private tool MyTool of name ToolInstance used by this algo:
53 MasterSeq/AthAllAlgSeq/AthAlgSeq/MyAlgo/MyInstance/MyTool/ToolInstance
54 A public tool would have path:
55 ToolSvc/MyTool/ToolInstance
57 The path specification can look like thi:
58 */ToolInstance - all tools that have matching instance name
59 */MyTool/* - all instances of the tool
60 */MyAlgo/MyInstance - specific algorithm
61 */MyAlg0/* - all instance of specific algorithm
62 */AthAlgSeq/* - all algorithms (with deeper sequences structure e.g. in HLT sub-components of sequences can controlled this way)
63 ToolSvc/My*/* - all public tools that instance name starts with My
65 The modifications to the OutputLevel are applied form ERROR to VERBOSE.
66 This is to support pattern when large group of components is set to less verbose logging mode
67 and with more specific selection more verbosity is enabled. E.g. all algorithms can be set to WARNING,
68 the all having calo in the name to INFO, and CaloCellMaker to DEBUG.
70 Each setting can be either a string or a list of strings.
72 If the component-path contains no '/' it is assumed to be a plain component-name. In this case,
73 the output-level is set using the property MessageSvc.setDebug (or equivalent). This works also
74 for converters that do not inherit PropertyHolder.
77 msgSvc=ca.getService(
"MessageSvc")
83 return ([d]
if d !=
'' else [])
if isinstance(d, str)
else d
84 for flag_val, level,setter
in [(flags.Exec.ErrorMessageComponents, ERROR, msgSvc.setError),
85 (flags.Exec.WarningMessageComponents, WARNING, msgSvc.setWarning),
86 (flags.Exec.InfoMessageComponents, INFO, msgSvc.setInfo),
87 (flags.Exec.DebugMessageComponents, DEBUG, msgSvc.setDebug),
88 (flags.Exec.VerboseMessageComponents, VERBOSE, msgSvc.setVerbose) ]:
89 for c
in __tolist(flag_val):
91 ca.foreach_component(c).OutputLevel=level