4 from __future__
import absolute_import
11 from inspect
import isclass
15 VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL
21 InvertNode, ControlFlowLeaf,
22 ControlFlowNode, CFTrue, CFFalse)
26 'Configurable',
'ConfigurableAlgorithm',
'ConfigurableAlgTool',
27 'ConfigurableAuditor',
'ConfigurableService',
'ConfigurableUser',
28 'VERBOSE',
'DEBUG',
'INFO',
'WARNING',
'ERROR',
'FATAL',
29 'appendPostConfigAction',
'removePostConfigAction' 34 log = logging.getLogger(
'Configurable')
39 Expand environment variables "data". 40 Data can be string, list, tuple and dictionary. For collection, all the 41 contained strings will be manipulated (recursively). 46 return os.path.expandvars(data)
47 elif typ
in [list, tuple]:
62 Error occurred in the configuration process. 70 class PropertyReference(object):
75 return "@%s" % self.
name 80 refname, refprop = self.
name.rsplit(
'.', 1)
81 if refname
in Configurable.allConfigurables:
82 conf = Configurable.allConfigurables[refname]
83 retval = getattr(conf, refprop)
84 if hasattr(retval,
"getFullName"):
85 retval = retval.getFullName()
88 "name '%s' not found resolving '%s'" % (refname, self))
92 """This function allow transparent integration with 93 Configurable.getValuedProperties. 100 except AttributeError:
110 """Base class for Gaudi components that implement the IProperty interface. 111 Provides most of the boilerplate code, but the actual useful classes 112 are its derived ConfigurableAlgorithm, ConfigurableService, and 113 ConfigurableAlgTool.""" 119 propertyNoValue =
'<no value>' 121 printHeaderWidth = 100
136 configurableServices = {
140 _configurationLocked =
False 143 """To Gaudi, any object with the same type/name is the same object. Hence, 144 this is mimicked in the configuration: instantiating a new Configurable 145 of a type with the same name will return the same instance.""" 148 func_code = six.get_function_code(cls.
__init__)
149 func_defaults = six.get_function_defaults(cls.
__init__)
153 name = kwargs[
'name']
154 elif 'name' in func_code.co_varnames:
156 index = list(func_code.co_varnames).index(
'name')
159 name = args[index - 1]
162 name = func_defaults[index - (len(args) + 1)]
167 except (IndexError, TypeError):
168 raise TypeError(
'no "name" argument while instantiating "%s"' %
173 if hasattr(cls,
'DefaultedName'):
174 name = cls.DefaultedName
177 elif not name
or type(name) != str:
180 'could not retrieve name from %s.__init__ arguments' %
185 if issubclass(cls, ConfigurableAlgTool)
and '.' not in name:
186 name =
'ToolSvc.' + name
201 for n, v
in kwargs.items():
205 conf, ConfigurableUser):
208 setattr(conf,
"_enabled",
True)
212 spos = name.find(
'/')
215 ti_name =
"%s/%s" % (name, name)
223 if i_name == name[spos + 1:]
and i_name
in cls.
configurables:
230 (spos > 0
and i_name == name[spos + 1:]
233 if conf.__class__
is ConfigurableGeneric:
237 newconf = object.__new__(cls)
238 cls.
__init__(newconf, *args, **kwargs)
243 for n
in newconf.__slots__:
245 for n
in conf._properties:
246 if names[n.lower()] != n:
248 "Option '%s' was used for %s, but the correct spelling is '%s'" 249 % (n, name, names[n.lower()]))
250 setattr(newconf, names[n.lower()], getattr(conf, n))
251 for n, v
in kwargs.items():
252 setattr(newconf, n, v)
259 'attempt to redefine type of "%s" (was: %s, new: %s)%s',
260 name, conf.__class__.__name__, cls.__name__,
266 for n, v
in kwargs.items():
271 conf = object.__new__(cls)
277 for base
in cls.__bases__:
278 if base.__name__ ==
'ConfigurableService':
290 klass = self.__class__
293 if klass == Configurable:
295 "%s is an ABC and can not be instantiated" % str(Configurable))
306 for meth, nArgs
in meths.items():
308 f = six.get_unbound_function(getattr(klass, meth))
309 except AttributeError:
310 raise NotImplementedError(
311 "%s is missing in class %s" % (meth, str(klass)))
314 nargcount = six.get_function_code(f).co_argcount
315 fdefaults = six.get_function_defaults(f)
316 ndefaults = fdefaults
and len(fdefaults)
or 0
317 if not nargcount - ndefaults <= nArgs <= nargcount:
318 raise TypeError(
"%s.%s requires exactly %d arguments" %
319 (klass, meth, nArgs))
327 if hasattr(self.__class__,
'DefaultedName'):
328 self.
_name = self.__class__.DefaultedName
351 dict[name] = proxy.__get__(self)
352 except AttributeError:
355 dict[
'_Configurable__children'] = self.
__children 356 dict[
'_Configurable__tools'] = self.
__tools 357 dict[
'_name'] = self.
_name 361 return (self.
_name, )
365 from contextlib
import contextmanager
376 for n, v
in dict.items():
388 newconf = object.__new__(self.__class__)
393 proxy.__set__(newconf, proxy.__get__(self))
394 except AttributeError:
404 if not type(configs)
in (list, tuple):
405 configs = (configs, )
411 if not isinstance(cfg, Configurable):
412 raise TypeError(
"'%s' is not a Configurable" % str(cfg))
417 ccjo = cc.getJobOptName()
419 if c.getJobOptName() == ccjo:
420 log.error(
'attempt to add a duplicate ... dupe ignored%s',
428 descr.__set__(self, cc)
430 setattr(self, cc.getName(), cc)
431 except AttributeError:
442 if isinstance(self.
_properties[attr].__get__(self),
443 DataObjectHandleBase):
447 if c.getName() == attr:
450 raise AttributeError(
451 "'%s' object has no attribute '%s'" % (self.__class__, attr))
456 "%s: Configuration cannot be modified after the ApplicationMgr has been started." 460 except AttributeError:
461 raise AttributeError(
462 "Configurable '%s' does not have property '%s'." %
463 (self.__class__.__name__, name))
470 prop.__delete__(self)
471 prop.__set__(self, prop.default)
481 if c.getName() == attr:
486 del self.__dict__[attr]
487 except (AttributeError, KeyError):
494 __nonzero__ = __bool__
497 if type(items) != list
and type(items) != tuple:
507 return copy.deepcopy(child)
521 if hasattr(cc,
'setParent')
and parent:
524 except RuntimeError
as e:
526 log.error(str(e) +
'%s', error_explanation)
527 ccbd = cc.configurables[cc.getJobOptName()]
531 if cc
in proxy.history:
532 proxy.__set__(ccbd, proxy.__get__(cc))
546 "children() is deprecated, use getChildren() instead for consistency" 549 "getChildren() returns a copy; to add a child, use 'parent += child'%s",
554 """Get all (private) configurable children, both explicit ones (added with +=) 555 and the ones in the private GaudiHandle properties""" 560 c = proxy.__get__(self)
561 except AttributeError:
564 if isinstance(c, Configurable)
and not c.isPublic():
566 elif isinstance(c, GaudiHandle):
568 conf = c.configurable
569 except AttributeError:
572 if not conf.isPublic():
574 elif isinstance(c, GaudiHandleArray):
578 if isinstance(ci, Configurable):
582 conf = ci.configurable
583 except AttributeError:
595 elems.append(c.getFullName())
600 if not hasattr(self,
'_initok')
or not self.
_initok:
602 raise TypeError(
"Configurable.__init__ not called in %s override" %
603 self.__class__.__name__)
617 handle = self.getHandle()
619 log.debug(
'no handle for %s: not transporting properties',
627 setattr(handle, name, getattr(self, name))
636 props[name] = proxy.__get__(self)
637 except AttributeError:
638 props[name] = Configurable.propertyNoValue
643 """Get all properties with their description string as { name : (value, desc) }.""" 647 props[name] = (proxy.__get__(self), proxy.__doc__)
648 except AttributeError:
649 props[name] = (Configurable.propertyNoValue, proxy.__doc__)
656 value = proxy.__get__(self)
657 if hasattr(value,
'getFullName'):
658 value = value.getFullName()
659 elif type(value)
in [list, tuple]:
662 if hasattr(i,
'getFullName'):
663 new_value.append(i.getFullName())
666 value =
type(value)(new_value)
667 elif type(value)
is dict:
670 if hasattr(value[i],
'getFullName'):
673 new_value[i] = value[i]
692 for k, v
in cls._properties.
items():
693 if not k
in c.__dict__
and hasattr(v,
'default'):
694 c.__dict__[k] = v.default
707 if name
in c.__dict__:
708 return c.__dict__[name]
712 v = cls._properties[name]
713 if hasattr(v,
'default'):
721 """Returns the value of the given property. 723 if hasattr(self, name):
724 return getattr(self, name)
729 """Set the value of a given property 731 return setattr(self, name, value)
734 """Tell if the property 'name' has been set or not. 736 Because of a problem with list and dictionary properties, in those cases 737 if the value is equal to the default, the property is considered as not 740 if not hasattr(self, name):
743 if isinstance(default, (list, dict, DataObjectHandleBase)):
744 value = getattr(self, name)
745 return value != default
766 "jobOptName() is deprecated, use getJobOptName() instead for consistency%s",
781 if log.isEnabledFor(logging.DEBUG):
789 def clone(self, name=None, **kwargs):
791 if hasattr(self,
'DefaultedName'):
792 name = self.DefaultedName
794 name = self.getType()
796 newconf = Configurable.__new__(self.__class__, name)
797 self.__class__.
__init__(newconf, name)
799 for proxy
in self._properties.values():
801 value = proxy.__get__(self)
802 if type(value)
in [str, list, dict, tuple]:
804 value =
type(value)(value)
805 proxy.__set__(newconf, value)
806 except AttributeError:
809 for c
in self.__children:
812 for n, t
in self.__tools.
items():
813 newconf.addTool(t, n)
815 for name, value
in kwargs.items():
816 setattr(newconf, name, value)
822 dot = fullname.find(
'.')
824 parentname = fullname[:dot]
825 longname = fullname[dot + 1:]
829 dot = longname.find(
'.')
831 name = longname[:dot]
834 return parentname, name, longname
837 if isclass(tool)
and issubclass(tool, ConfigurableAlgTool):
840 priv_tool = tool(self.
getName() +
'.' + name)
841 elif isinstance(tool, ConfigurableAlgTool):
843 name = tool.splitName()[1]
844 priv_tool = tool.clone(self.
getName() +
'.' + name)
847 classname = tool.__name__
849 classname =
type(tool).__name__
851 "addTool requires AlgTool configurable. Got %s type" %
856 setattr(self, name, self.
__tools[name])
871 handle = __main__.Service(svc)
876 if hasattr(self,
'configure' + svc):
877 eval(
'self.configure' + svc +
'( handle )')
880 dlls = self.getDlls()
883 elif type(dlls) == types.StringType:
886 from __main__
import theApp
887 dlls = filter(
lambda d: d
not in theApp.Dlls, dlls)
900 preLen = Configurable.printHeaderPre
901 postLen = Configurable.printHeaderWidth - \
902 preLen - 3 - len(title)
903 postLen =
max(preLen, postLen)
904 return indentStr +
'/%s %s %s' % (preLen *
'*', title, postLen *
'*')
908 preLen = Configurable.printHeaderPre
909 postLen = Configurable.printHeaderWidth - \
910 preLen - 12 - len(title)
911 postLen =
max(preLen, postLen)
912 return indentStr +
'\\%s (End of %s) %s' % (preLen *
'-', title,
916 return '{0}({1!r})'.
format(self.__class__.__name__, self.
name())
918 def __str__(self, indent=0, headerLastIndentUnit=indentUnit):
920 indentStr = indent * Configurable.indentUnit
925 headerIndent = (indent - 1) * \
926 Configurable.indentUnit + headerLastIndentUnit
929 rep = Configurable._printHeader(headerIndent, title)
935 rep += indentStr +
'|-<no properties>' + os.linesep
939 for p
in props.keys():
940 nameWidth =
max(nameWidth, len(p))
941 for p, v
in props.items():
943 prefix = indentStr +
'|-%-*s' % (nameWidth, p)
945 if log.isEnabledFor(logging.DEBUG):
946 if v != Configurable.propertyNoValue:
947 address =
' @%11s' %
hex(id(v))
952 default = defs.get(p)
953 if v == Configurable.propertyNoValue:
955 strVal = repr(default)
959 if hasattr(v,
"getGaudiHandle"):
960 vv = v.getGaudiHandle()
963 if isinstance(vv, GaudiHandle)
or isinstance(
964 vv, GaudiHandleArray):
967 if hasattr(default,
"toStringProperty"):
968 strDef = repr(default.toStringProperty())
970 strDef = repr(default)
971 if strDef == repr(vv.toStringProperty()):
975 strDef = repr(default)
977 line = prefix +
' = ' + strVal
979 if strDef
is not None:
981 if len(line) + len(strDef) > Configurable.printHeaderWidth:
982 line += os.linesep + indentStr +
'| ' + \
983 (len(prefix) - len(indentStr) - 3) *
' ' 984 line +=
' (default: %s)' % (strDef, )
986 rep += line + os.linesep
998 rep += cfg.__str__(indent + 1,
'|=') + os.linesep
1001 rep += Configurable._printFooter(indentStr, title)
1006 Return True is the instance can be "applied". 1007 Always False for plain Configurable instances 1008 (i.e. not ConfigurableUser). 1024 object.__setattr__(obj, self.
__name__, value)
1031 Configurable.__init__(self, name)
1040 return 'GenericComponent' 1051 super(ConfigurableGeneric, self).
__setattr__(name, value)
1055 if isinstance(value, Configurable):
1056 self.__dict__[name] = value
1060 if not name
in self._properties:
1062 self._properties[name].__set__(self, value)
1076 'AuditAlgorithms': 0,
1077 'AuditInitialize': 0,
1078 'AuditReinitialize': 0,
1086 super(ConfigurableAlgorithm, self).
__init__(name)
1107 elif rhs
is CFFalse:
1109 return AndNode(self, rhs)
1116 return OrNode(self, rhs)
1119 return InvertNode(self)
1122 return OrderedNode(self, rhs)
1133 return (repr(self) == repr(other))
1136 """Return a unique identifier for this object. 1138 As we use the `repr` of this object to check for equality, we use it 1139 here to define uniqueness. 1142 return hash((repr(self), ))
1149 'AuditInitialize': 0,
1160 return iService(self.
_name)
1179 'AuditInitialize': 0,
1184 super(ConfigurableAlgTool, self).
__init__(name)
1185 if '.' not in self.
_name:
1189 name = name[name.find(
'/') + 1:]
1211 return pop + Configurable.getPrintTitle(self)
1220 if isinstance(c, ConfigurableAlgTool):
1221 c.setParent(parentName)
1225 name = name[name.rfind(
'.') + 1:]
1256 name = name[name.rfind(
'.') + 1:]
1257 return str(self.
getType() +
'/' + name)
1264 __slots__ = {
'_jobOptName': 0,
'OutputLevel': 0,
'Enable': 1}
1267 super(ConfigurableAuditor, self).
__init__(name)
1269 name = name[name.find(
'/') + 1:]
1291 "__used_instances__": [],
1303 __used_configurables__ = []
1306 __queried_configurables__ = []
1308 def __init__(self, name=Configurable.DefaultName, _enabled=True, **kwargs):
1309 super(ConfigurableUser, self).
__init__(name)
1310 for n, v
in kwargs.items():
1328 if type(used)
is tuple:
1329 used, used_name = used
1333 if type(used)
is str:
1334 used_class = confDbGetConfigurable(used)
1339 inst = used_class(name=used_name, _enabled=
False)
1340 except AttributeError:
1344 inst = used_class(name=used_name)
1348 if type(queried)
is str:
1349 queried = confDbGetConfigurable(used)
1350 inst = queried(_enabled=
False)
1351 except AttributeError:
1357 Declare that we are going to modify the Configurable 'other' in our 1358 __apply_configuration__. 1361 if hasattr(other,
"__users__"):
1362 other.__users__.append(self)
1366 Declare that we are going to retrieve property values from the 1367 ConfigurableUser 'other' in our __apply_configuration__. 1369 if not isinstance(other, ConfigurableUser):
1371 "'%s': Cannot make passive use of '%s', it is not a ConfigurableUser" 1372 % (self.
name(), other.name()))
1373 other.__addActiveUseOf(self)
1387 Remove this ConfigurableUser instance from the users list of the used 1393 used.__users__.remove(self)
1397 Propagate the property 'name' (if set) to other configurables (if possible). 1400 propagate to all the entries in __used_configurables__ 1401 a configurable instance: 1402 propagate only to it 1403 list of configurable instances: 1404 propagate to all of them. 1408 - if the local property is set, the other property will be overwritten 1409 - local property not set and other set => keep other 1410 - local property not set and other not set => overwrite the default for 1411 ConfigurableUser instances and set the property for Configurables 1416 elif type(others)
not in [list, tuple]:
1422 for other
in [o
for o
in others
if name
in o.__slots__]:
1425 if other.isPropertySet(name):
1427 "Property '%(prop)s' is set in both '%(self)s' and '%(other)s', using '%(self)s.%(prop)s'" 1429 "self": self.
name(),
1430 "other": other.name(),
1433 other.setProp(name, value)
1435 elif not other.isPropertySet(name):
1436 if isinstance(other, ConfigurableUser):
1437 otherType =
type(other._properties[name].getDefault())
1438 other._properties[name].setDefault(value)
1439 if otherType
in [list, dict]:
1442 other.setProp(name, otherType(value))
1444 other.setProp(name, value)
1449 Call propagateProperty for each property listed in 'names'. 1450 If 'names' is None, all the properties are propagated. 1454 names = [p
for p
in self.
__slots__ if not p.startswith(
"_")]
1460 Function to be overridden to convert the high level configuration into a 1462 The default implementation calls applyConf, which is the method defined 1463 in some ConfigurableUser implementations. 1469 Function to be overridden to convert the high level configuration into a 1476 Function used to define the name of the private instance of a given class 1478 This method is used when the __used_configurables_property__ declares the 1479 need of a private used configurable without specifying the name. 1481 if type(cls)
is str:
1484 clName = cls.__name__
1485 return "%s_%s" % (self.name(), clName)
1489 Return the used instance with a given name. 1492 if i.name() == name:
1493 if hasattr(i,
"_enabled"):
1498 raise KeyError(name)
1502 Return True is the instance can be "applied". 1508 postConfigActions = []
1513 Add a new callable ('function') to the list of post-configuration actions. 1514 If the callable is already in the list, it is moved to the end of the list. 1515 The list is directly accessible as 'GaudiKernel.Configurable.postConfigActions'. 1518 postConfigActions.remove(function)
1521 postConfigActions.append(function)
1526 Remove a callable from the list of post-config actions. 1527 The list is directly accessible as 'GaudiKernel.Configurable.postConfigActions'. 1529 postConfigActions.remove(function)
1532 _appliedConfigurableUsers_ =
False 1537 Call the apply method of all the ConfigurableUser instances respecting the 1538 dependencies. First the C.U.s that are not used by anybody, then the used 1539 ones, when they are not used anymore. 1542 global _appliedConfigurableUsers_, postConfigActions
1543 if _appliedConfigurableUsers_:
1545 _appliedConfigurableUsers_ =
True 1547 def applicableConfUsers():
1549 Generator returning all the configurables that can be applied in the 1550 order in which they can be applied. 1562 yield next(c
for c
in Configurable.allConfigurables.values()
1563 if c.isApplicable())
1565 debugApplyOrder =
'GAUDI_DUBUG_CONF_USER' in os.environ
1566 for c
in applicableConfUsers():
1568 log.info(
"applying configuration of %s", c.name())
1570 sys.stderr.write(
'applying %r' % c)
1571 c.__apply_configuration__()
1574 log.info(
"skipping configuration of %s", c.name())
1576 if hasattr(c,
"__detach_used__"):
1582 c
for c
in Configurable.allConfigurables.values()
if 1583 hasattr(c,
'__apply_configuration__')
and c._enabled
and not c._applied
1587 raise Error(
"Detected loop in the ConfigurableUser" 1588 " dependencies: %r" % [c.name()
for c
in leftConfUsers])
1591 unknown = set(Configurable.allConfigurables)
1595 log.debug(
'new configurable created automatically: %s', k)
1597 Configurable.allConfigurables[k].
properties()
1601 for action
in postConfigActions:
1607 Obsolete (buggy) implementation of applyConfigurableUsers(), kept to provide 1608 backward compatibility for configurations that where relying (implicitly) on 1609 bug #103803, or on a specific (non guaranteed) order of execution. 1611 @see applyConfigurableUsers() 1614 global _appliedConfigurableUsers_, postConfigActions
1615 if _appliedConfigurableUsers_:
1617 _appliedConfigurableUsers_ =
True 1619 debugApplyOrder =
'GAUDI_DUBUG_CONF_USER' in os.environ
1621 c
for c
in Configurable.allConfigurables.values()
1622 if hasattr(c,
"__apply_configuration__")
1625 while applied
and confUsers:
1629 if hasattr(c,
"__users__")
and c.__users__:
1630 newConfUsers.append(c)
1635 enabled = (
not hasattr(c,
"_enabled"))
or c._enabled
1637 log.info(
"applying configuration of %s", c.name())
1639 sys.stderr.write(
'applying %r' % c)
1640 c.__apply_configuration__()
1643 log.info(
"skipping configuration of %s", c.name())
1644 if hasattr(c,
"__detach_used__"):
1647 confUsers = newConfUsers
1650 raise Error(
"Detected loop in the ConfigurableUser " 1651 " dependencies: %r" % [c.name()
for c
in confUsers])
1654 unknown = set(Configurable.allConfigurables)
1658 log.debug(
'new configurable created automatically: %s', k)
1660 Configurable.allConfigurables[k].
properties()
1664 for action
in postConfigActions:
1670 Function to select all and only the configurables that have to be used in 1671 GaudiPython.AppMgr constructor. 1672 This is needed because in Athena the implementation have to be different (the 1673 configuration is used in a different moment). 1676 k
for k, v
in Configurable.allConfigurables.items()
1677 if v.getGaudiType() !=
"User")
1682 Clean up all configurations and configurables. 1684 for c
in Configurable.allConfigurables.values():
1685 c.__class__.configurables.clear()
1686 Configurable.allConfigurables.clear()
1689 ConfigurableGeneric.configurables.clear()
1690 from .ProcessJobOptions
import _included_files
1693 for file
in _included_files:
1694 dirname, basname = os.path.split(file)
1695 basname, ext = os.path.splitext(basname)
1696 if basname
in sys.modules:
1697 del sys.modules[basname]
1698 _included_files.clear()
1707 return self.
stack[-1]
1715 name = prefix + str(cnt)
1716 while name
in allConfigurables:
1718 name = prefix + str(cnt)
1722 from Configurables
import GaudiSequencer
1727 if visitee
in (CFTrue, CFFalse):
1728 stack.append(self.
_newSeq(Invert=visitee
is CFFalse))
1729 elif isinstance(visitee, (ControlFlowLeaf, ConfigurableAlgorithm)):
1730 stack.append(visitee)
1731 elif isinstance(visitee, (OrNode, AndNode, OrderedNode)):
1736 ModeOR=isinstance(visitee, OrNode),
1737 ShortCircuit=
not isinstance(visitee, OrderedNode),
1740 elif isinstance(visitee, ignore):
1741 if hasattr(stack[-1],
'IgnoreFilterPassed'):
1742 stack[-1].IgnoreFilterPassed =
True 1746 Members=[stack.pop()], IgnoreFilterPassed=
True))
1747 elif isinstance(visitee, InvertNode):
1748 if hasattr(stack[-1],
'Invert'):
1749 stack[-1].Invert =
True 1751 stack.append(self.
_newSeq(Members=[stack.pop()], Invert=
True))
1756 Convert a control flow expression to nested GaudiSequencers. 1758 if not isinstance(expression, ControlFlowNode):
1759 raise ValueError(
'ControlFlowNode instance expected, got %s' %
1760 type(expression).__name__)
1762 expression.visitNode(visitor)
1763 return visitor.sequence
1768 Helper class to use a ControlFlowNode as an algorithm configurable 1775 if name
in Configurable.allConfigurables:
1776 instance = Configurable.allConfigurables[name]
1777 assert type(instance)
is cls, \
1778 (
'trying to reuse {0!r} as name of a {1} instance while it''s ' 1779 'already used for an instance of {2}').
format(
1782 type(instance).__name__)
1785 instance = super(SuperAlgorithm, cls).
__new__(cls)
1786 Configurable.allConfigurables[name] = instance
1793 setattr(self, key, kwargs[key])
1818 Instantiate and algorithm of type 'typ' with a name suitable for use 1819 inside a SuperAlgorithm. 1821 name =
'{0}_{1}'.
format(self.
name, kwargs.pop(
'name', typ.getType()))
1822 return typ(name, **kwargs)
1825 raise NotImplementedError()
1832 self.
graph.visitNode(visitor)
1835 super(SuperAlgorithm, self).
__setattr__(name, value)
1836 if name
in (
'_name',
'graph'):
1840 class PropSetter(object):
1841 def enter(self, node):
1843 setattr(node, name, value)
1844 except (ValueError, AttributeError):
1848 def leave(self, node):
1851 self._visitSubNodes(PropSetter())
def __init__(self, name=None, **kwargs)
def getNeededConfigurables()
def __deepcopy__(self, memo)
def propagateProperty(self, name, others=None, force=True)
def setParent(self, parentName)
def __apply_configuration__(self)
dictionary allConfigurables
def __deepcopy__(self, memo)
def __detach_used__(self)
def __setstate__(self, dict)
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
list __queried_configurables__
def _printHeader(indentStr, title)
def _getUniqueName(self, prefix)
def __new__(cls, name=None, **kwargs)
dictionary configurableServices
def __addPassiveUseOf(self, other)
def clone(self, name=None, **kwargs)
def hasParent(self, parent)
def appendPostConfigAction(function)
def __new__(cls, *args, **kwargs)
Sequencer for executing several algorithms, stopping when one is faulty.
def __init__(self, name=DefaultName)
def getPropertiesWithDescription(self)
def addTool(self, tool, name=None)
def __setupDefaults(self)
def makeSequences(expression)
def _printFooter(indentStr, title)
def _visitSubNodes(self, visitor)
def applyConfigurableUsers()
def _instanceName(self, cls)
def setProp(self, name, value)
list __used_configurables__
def __deepcopy__(self, memo)
MsgStream & hex(MsgStream &log)
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
def __init__(self, name=Configurable.DefaultName, _enabled=True, **kwargs)
def __init__(self, name=Configurable.DefaultName)
def __getattr__(self, attr)
def __init__(self, name=Configurable.DefaultName)
def __init__(self, propname)
def __deepcopy__(self, memo)
def copyChildAndSetParent(self, cfg, parent)
def __setattr__(self, name, value)
def __addActiveUseOf(self, other)
def setDefaults(cls, handle)
def __iadd__(self, configs, descr=None)
def isPropertySet(self, name)
def toStringProperty(self)
def getDefaultProperties(cls)
def __rshift__(self, rhs)
def __delattr__(self, attr)
def getUsedInstance(self, name)
def _makeAlg(self, typ, **kwargs)
def copyChild(self, child)
def applyConfigurableUsers_old()
def __setattr__(self, name, value)
def getFullJobOptName(self)
def __set__(self, obj, value)
def removePostConfigAction(function)
def __str__(self, indent=0, headerLastIndentUnit=indentUnit)
bool _configurationLocked
def __setupServices(self)
def _isInSetDefaults(self)
def __init__(self, name=Configurable.DefaultName)
def _newSeq(self, prefix='seq_', **kwargs)
def getDefaultProperty(cls, name)
def toStringProperty(self)
def propagateProperties(self, names=None, others=None, force=True)
def __get__(self, obj, type=None)
def _visitSubNodes(self, visitor)
def copyChild(self, child)
def getValuedProperties(self)
def __setattr__(self, name, value)
def isApplicable(self)
rep += v.__str__( indent + 1 ) + os.linesep elif isinstance(v,GaudiHandleArray): for vi in v: if isin...
def visitNode(self, visitor)