The Gaudi Framework  v36r1 (3e2fb5a8)
ConfigurableUser.py
Go to the documentation of this file.
1 
11 """
12 Example of usage of ConfigurableUser classes (for high level configuration).
13 """
14 from __future__ import print_function
15 from Gaudi.Configuration import *
16 
17 
19  __slots__ = {"EvtMax": 1, "Read": "NONE", "Write": "NONE"}
20  __used_configurables__ = [ApplicationMgr]
21 
23  # Propagate the properties to all used configurables
24  # In this case the only effect is to set the ApplicationMgr EvtMax.
25  self.propagateProperties()
26 
27  read = self.getProp("Read")
28  if read == "NONE":
29  ApplicationMgr(EvtSel="NONE")
30  else:
31  log.warning("%s: Cannot handle value %r of property Read",
32  self.name(), read)
33 
34  write = self.getProp("Write")
35  if read == "NONE":
36  ApplicationMgr(HistogramPersistency="NONE")
37  else:
38  log.warning("%s: Cannot handle value %r of property Write",
39  self.name(), write)
40 
41 
43  __slots__ = {"OutputLevel": INFO, "StatusCodeCheck": False}
44  __used_configurables__ = []
45 
47  ApplicationMgr().StatusCodeCheck = self.getProp("StatusCodeCheck")
48  MessageSvc().OutputLevel = self.getProp("OutputLevel")
49 
50 
52  __slots__ = {
53  "FullDebug": False,
54  "TopAlg": [],
55  }
56  __used_configurables__ = [ExampleCommon, ApplicationMgr]
57 
59  if self.getProp("FullDebug"):
60  ExampleCommon(OutputLevel=VERBOSE, StatusCodeCheck=True)
61  else:
62  ExampleCommon(OutputLevel=INFO, StatusCodeCheck=False)
63  # Propagate the properties to all used configurables
64  # In this case the only effect is to set the ApplicationMgr TopAlg.
65  self.propagateProperties()
66 
67 
69  """
70  Action printing the result of the configuration of the ApplicationMgr.
71  """
72  print("==== Configuration completed ====")
73  print(ApplicationMgr())
74 
75 
76 appendPostConfigAction(PostConfAction)
77 
78 ExampleApplication(TopAlg=["GaudiExamples::TimingAlg/Timing"], FullDebug=True)
79 ExampleIO(EvtMax=10)
GaudiKernel.Configurable.ConfigurableUser
Definition: Configurable.py:1296
ConfigurableUser.ExampleCommon
Definition: ConfigurableUser.py:42
GaudiKernel.Configurable.ConfigurableUser.propagateProperties
def propagateProperties(self, names=None, others=None, force=True)
Definition: Configurable.py:1455
GaudiKernel.Configurable.Configurable.getProp
def getProp(self, name)
Definition: Configurable.py:729
ConfigurableUser.ExampleIO
Definition: ConfigurableUser.py:18
ConfigurableUser.ExampleApplication.__apply_configuration__
def __apply_configuration__(self)
Definition: ConfigurableUser.py:58
GaudiKernel.Configurable.Configurable.name
def name(self)
Definition: Configurable.py:763
ConfigurableUser.ExampleCommon.__apply_configuration__
def __apply_configuration__(self)
Definition: ConfigurableUser.py:46
GaudiKernel.Configurable.appendPostConfigAction
def appendPostConfigAction(function)
Definition: Configurable.py:1519
Gaudi.Configuration
Definition: Configuration.py:1
MessageSvc
Definition: MessageSvc.h:40
ConfigurableUser.ExampleApplication
Definition: ConfigurableUser.py:51
ConfigurableUser.PostConfAction
def PostConfAction()
Definition: ConfigurableUser.py:68
ApplicationMgr
Definition: ApplicationMgr.h:57
ConfigurableUser.ExampleIO.__apply_configuration__
def __apply_configuration__(self)
Definition: ConfigurableUser.py:22