7 __version__ =
'$Revision: 1.21 $'
8 __author__ =
"""Wim Lavrijsen (WLavrijsen@lbl.gov)
9 Sebastien Binet <binet@cern.ch>
12 __all__ = [
'AlgSequence',
'AthSequencer',
17 import GaudiSequencer.GaudiSequencerConf
as GaudiSequencerConf
24 """Sequence of Gaudi algorithms"""
26 def __init__( self, name = "AthSequencer", **kwargs ):
28 super( AthSequencer, self ).
__init__( name, **kwargs )
35 if 'Members' in props:
36 props[
'Members'] = [ c.getFullName()
for c
in self.getChildren() ]
40 self.__iadd__( item, index = index )
48 self._flags &= ~self._fIsLocked
50 self.
Members = [ c.getFullName()
for c
in self.getChildren() ]
52 from AthenaCommon
import Logging
53 msg = Logging.logging.getLogger(
"AthSequencer" )
54 msg.debug(
'setup of sequence: %s', self.getName() )
55 if msg.isEnabledFor( Logging.logging.VERBOSE ):
57 msg.verbose(
'layout of sequence: %s\n%s', self.getName(),
str(self) )
60 super( AthSequencer, self ).
setup()
63 from AthenaCommon
import CfgMgr
64 CfgMgr.AthSequencer = AthSequencer
70 """Convenience method to get the default sequence for algorithms"""
76 """iterate over a (possibly nested) ``seq`` AlgSequence.
78 if the sequence contains nested sub-sequences, everything will be flatten
82 >>> import AthenaCommon.AlgSequence as acas
83 >>> aaa = CfgMgr.AthSequencer('aaa')
84 >>> aaa += CfgMgr.AthSequencer('aaa1')
85 >>> aaa.aaa1 += CfgMgr.AthSequencer('aaa2')
86 >>> aaa.aaa1.aaa2 += CfgMgr.AthSequencer('aaa3')
87 >>> aaa.aaa1.aaa2.aaa3 += CfgMgr.AthSequencer('aaa4')
88 >>> aaa.aaa1.aaa2.aaa3.aaa4 += CfgMgr.AthSequencer('aaa5')
89 >>> aaa += CfgMgr.AthSequencer('aaa11')
90 >>> aaa.aaa11 += CfgMgr.AthSequencer('aaa21')
91 >>> print ([c.getName() for c in acas.iter_algseq(aaa)])
92 ['aaa', 'aaa1', 'aaa2', 'aaa3', 'aaa4', 'aaa5', 'aaa11', 'aaa21']
94 def _iter_algseq(seq):
96 for c
in seq.getChildren():
97 for sub
in _iter_algseq(c):
99 return _iter_algseq(seq)
102 def _dump (seq, indent):
104 for c
in seq.getChildren():
105 o.append( (c.getFullName(), indent) )
106 o.extend( _dump (c, indent+1) )
108 out = [(seq.getFullName(),indent)]
109 out.extend( _dump( seq, indent=indent+1 ) )
111 print (
" "*i,
"+--",n)
115 Helper function to display on screen the current master sequencer layout
119 from AthenaCommon.AppMgr
import theApp, AthAppMgr
120 app_state = theApp.state()
121 if app_state != AthAppMgr.State.OFFLINE: