14 from __future__
import absolute_import
21 from inspect
import isclass
25 VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL
31 InvertNode, ControlFlowLeaf,
32 ControlFlowNode, CFTrue, CFFalse)
36 'Configurable',
'ConfigurableAlgorithm',
'ConfigurableAlgTool',
37 'ConfigurableAuditor',
'ConfigurableService',
'ConfigurableUser',
38 'VERBOSE',
'DEBUG',
'INFO',
'WARNING',
'ERROR',
'FATAL',
39 'appendPostConfigAction',
'removePostConfigAction' 44 log = logging.getLogger(
'Configurable')
49 Expand environment variables "data". 50 Data can be string, list, tuple and dictionary. For collection, all the 51 contained strings will be manipulated (recursively). 56 return os.path.expandvars(data)
57 elif typ
in [list, tuple]:
72 Error occurred in the configuration process. 80 class PropertyReference(object):
85 return "@%s" % self.
name 90 refname, refprop = self.
name.rsplit(
'.', 1)
91 if refname
in Configurable.allConfigurables:
92 conf = Configurable.allConfigurables[refname]
93 retval = getattr(conf, refprop)
94 if hasattr(retval,
"getFullName"):
95 retval = retval.getFullName()
98 "name '%s' not found resolving '%s'" % (refname, self))
102 """This function allow transparent integration with 103 Configurable.getValuedProperties. 110 except AttributeError:
120 """Base class for Gaudi components that implement the IProperty interface. 121 Provides most of the boilerplate code, but the actual useful classes 122 are its derived ConfigurableAlgorithm, ConfigurableService, and 123 ConfigurableAlgTool.""" 129 propertyNoValue =
'<no value>' 131 printHeaderWidth = 100
146 configurableServices = {
150 _configurationLocked =
False 153 """To Gaudi, any object with the same type/name is the same object. Hence, 154 this is mimicked in the configuration: instantiating a new Configurable 155 of a type with the same name will return the same instance.""" 158 func_code = six.get_function_code(cls.
__init__)
159 func_defaults = six.get_function_defaults(cls.
__init__)
163 name = kwargs[
'name']
164 elif 'name' in func_code.co_varnames:
166 index = list(func_code.co_varnames).index(
'name')
169 name = args[index - 1]
172 name = func_defaults[index - (len(args) + 1)]
177 except (IndexError, TypeError):
178 raise TypeError(
'no "name" argument while instantiating "%s"' %
183 if hasattr(cls,
'DefaultedName'):
184 name = cls.DefaultedName
187 elif not name
or type(name) != str:
190 'could not retrieve name from %s.__init__ arguments' %
195 if issubclass(cls, ConfigurableAlgTool)
and '.' not in name:
196 name =
'ToolSvc.' + name
211 for n, v
in kwargs.items():
215 conf, ConfigurableUser):
218 setattr(conf,
"_enabled",
True)
222 spos = name.find(
'/')
225 ti_name =
"%s/%s" % (name, name)
233 if i_name == name[spos + 1:]
and i_name
in cls.
configurables:
240 (spos > 0
and i_name == name[spos + 1:]
243 if conf.__class__
is ConfigurableGeneric:
247 newconf = object.__new__(cls)
248 cls.
__init__(newconf, *args, **kwargs)
253 for n
in newconf.__slots__:
255 for n
in conf._properties:
256 if names[n.lower()] != n:
258 "Option '%s' was used for %s, but the correct spelling is '%s'" 259 % (n, name, names[n.lower()]))
260 setattr(newconf, names[n.lower()], getattr(conf, n))
261 for n, v
in kwargs.items():
262 setattr(newconf, n, v)
269 'attempt to redefine type of "%s" (was: %s, new: %s)%s',
270 name, conf.__class__.__name__, cls.__name__,
276 for n, v
in kwargs.items():
281 conf = object.__new__(cls)
287 for base
in cls.__bases__:
288 if base.__name__ ==
'ConfigurableService':
300 klass = self.__class__
303 if klass == Configurable:
305 "%s is an ABC and can not be instantiated" % str(Configurable))
316 for meth, nArgs
in meths.items():
318 f = six.get_unbound_function(getattr(klass, meth))
319 except AttributeError:
320 raise NotImplementedError(
321 "%s is missing in class %s" % (meth, str(klass)))
324 nargcount = six.get_function_code(f).co_argcount
325 fdefaults = six.get_function_defaults(f)
326 ndefaults = fdefaults
and len(fdefaults)
or 0
327 if not nargcount - ndefaults <= nArgs <= nargcount:
328 raise TypeError(
"%s.%s requires exactly %d arguments" %
329 (klass, meth, nArgs))
337 if hasattr(self.__class__,
'DefaultedName'):
338 self.
_name = self.__class__.DefaultedName
361 dict[name] = proxy.__get__(self)
362 except AttributeError:
365 dict[
'_Configurable__children'] = self.
__children 366 dict[
'_Configurable__tools'] = self.
__tools 367 dict[
'_name'] = self.
_name 371 return (self.
_name, )
375 from contextlib
import contextmanager
386 for n, v
in dict.items():
398 newconf = object.__new__(self.__class__)
403 proxy.__set__(newconf, proxy.__get__(self))
404 except AttributeError:
414 if not type(configs)
in (list, tuple):
415 configs = (configs, )
421 if not isinstance(cfg, Configurable):
422 raise TypeError(
"'%s' is not a Configurable" % str(cfg))
427 ccjo = cc.getJobOptName()
429 if c.getJobOptName() == ccjo:
430 log.error(
'attempt to add a duplicate ... dupe ignored%s',
438 descr.__set__(self, cc)
440 setattr(self, cc.getName(), cc)
441 except AttributeError:
452 if isinstance(self.
_properties[attr].__get__(self),
453 DataObjectHandleBase):
457 if c.getName() == attr:
460 raise AttributeError(
461 "'%s' object has no attribute '%s'" % (self.__class__, attr))
466 "%s: Configuration cannot be modified after the ApplicationMgr has been started." 470 except AttributeError:
471 raise AttributeError(
472 "Configurable '%s' does not have property '%s'." %
473 (self.__class__.__name__, name))
480 prop.__delete__(self)
481 prop.__set__(self, prop.default)
491 if c.getName() == attr:
496 del self.__dict__[attr]
497 except (AttributeError, KeyError):
504 __nonzero__ = __bool__
507 if type(items) != list
and type(items) != tuple:
517 return copy.deepcopy(child)
531 if hasattr(cc,
'setParent')
and parent:
534 except RuntimeError
as e:
536 log.error(str(e) +
'%s', error_explanation)
537 ccbd = cc.configurables[cc.getJobOptName()]
541 if cc
in proxy.history:
542 proxy.__set__(ccbd, proxy.__get__(cc))
556 "children() is deprecated, use getChildren() instead for consistency" 559 "getChildren() returns a copy; to add a child, use 'parent += child'%s",
564 """Get all (private) configurable children, both explicit ones (added with +=) 565 and the ones in the private GaudiHandle properties""" 570 c = proxy.__get__(self)
571 except AttributeError:
574 if isinstance(c, Configurable)
and not c.isPublic():
576 elif isinstance(c, GaudiHandle):
578 conf = c.configurable
579 except AttributeError:
582 if not conf.isPublic():
584 elif isinstance(c, GaudiHandleArray):
588 if isinstance(ci, Configurable):
592 conf = ci.configurable
593 except AttributeError:
605 elems.append(c.getFullName())
610 if not hasattr(self,
'_initok')
or not self.
_initok:
612 raise TypeError(
"Configurable.__init__ not called in %s override" %
613 self.__class__.__name__)
627 handle = self.getHandle()
629 log.debug(
'no handle for %s: not transporting properties',
637 setattr(handle, name, getattr(self, name))
646 props[name] = proxy.__get__(self)
647 except AttributeError:
648 props[name] = Configurable.propertyNoValue
653 """Get all properties with their description string as { name : (value, desc) }.""" 657 props[name] = (proxy.__get__(self), proxy.__doc__)
658 except AttributeError:
659 props[name] = (Configurable.propertyNoValue, proxy.__doc__)
666 value = proxy.__get__(self)
667 if hasattr(value,
'getFullName'):
668 value = value.getFullName()
669 elif type(value)
in [list, tuple]:
672 if hasattr(i,
'getFullName'):
673 new_value.append(i.getFullName())
676 value =
type(value)(new_value)
677 elif type(value)
is dict:
680 if hasattr(value[i],
'getFullName'):
683 new_value[i] = value[i]
702 for k, v
in cls._properties.
items():
703 if not k
in c.__dict__
and hasattr(v,
'default'):
704 c.__dict__[k] = v.default
717 if name
in c.__dict__:
718 return c.__dict__[name]
722 v = cls._properties[name]
723 if hasattr(v,
'default'):
731 """Returns the value of the given property. 733 if hasattr(self, name):
734 return getattr(self, name)
739 """Set the value of a given property 741 return setattr(self, name, value)
744 """Tell if the property 'name' has been set or not. 746 Because of a problem with list and dictionary properties, in those cases 747 if the value is equal to the default, the property is considered as not 750 if not hasattr(self, name):
753 if isinstance(default, (list, dict, DataObjectHandleBase)):
754 value = getattr(self, name)
755 return value != default
776 "jobOptName() is deprecated, use getJobOptName() instead for consistency%s",
791 if log.isEnabledFor(logging.DEBUG):
799 def clone(self, name=None, **kwargs):
801 if hasattr(self,
'DefaultedName'):
802 name = self.DefaultedName
804 name = self.getType()
806 newconf = Configurable.__new__(self.__class__, name)
807 self.__class__.
__init__(newconf, name)
809 for proxy
in self._properties.values():
811 value = proxy.__get__(self)
812 if type(value)
in [str, list, dict, tuple]:
814 value =
type(value)(value)
815 proxy.__set__(newconf, value)
816 except AttributeError:
819 for c
in self.__children:
822 for n, t
in self.__tools.
items():
823 newconf.addTool(t, n)
825 for name, value
in kwargs.items():
826 setattr(newconf, name, value)
832 dot = fullname.find(
'.')
834 parentname = fullname[:dot]
835 longname = fullname[dot + 1:]
839 dot = longname.find(
'.')
841 name = longname[:dot]
844 return parentname, name, longname
847 if isclass(tool)
and issubclass(tool, ConfigurableAlgTool):
850 priv_tool = tool(self.
getName() +
'.' + name)
851 elif isinstance(tool, ConfigurableAlgTool):
853 name = tool.splitName()[1]
854 priv_tool = tool.clone(self.
getName() +
'.' + name)
857 classname = tool.__name__
859 classname =
type(tool).__name__
861 "addTool requires AlgTool configurable. Got %s type" %
866 setattr(self, name, self.
__tools[name])
881 handle = __main__.Service(svc)
886 if hasattr(self,
'configure' + svc):
887 eval(
'self.configure' + svc +
'( handle )')
890 dlls = self.getDlls()
893 elif type(dlls) == types.StringType:
896 from __main__
import theApp
897 dlls = filter(
lambda d: d
not in theApp.Dlls, dlls)
910 preLen = Configurable.printHeaderPre
911 postLen = Configurable.printHeaderWidth - \
912 preLen - 3 - len(title)
913 postLen =
max(preLen, postLen)
914 return indentStr +
'/%s %s %s' % (preLen *
'*', title, postLen *
'*')
918 preLen = Configurable.printHeaderPre
919 postLen = Configurable.printHeaderWidth - \
920 preLen - 12 - len(title)
921 postLen =
max(preLen, postLen)
922 return indentStr +
'\\%s (End of %s) %s' % (preLen *
'-', title,
926 return '{0}({1!r})'.
format(self.__class__.__name__, self.
name())
928 def __str__(self, indent=0, headerLastIndentUnit=indentUnit):
930 indentStr = indent * Configurable.indentUnit
935 headerIndent = (indent - 1) * \
936 Configurable.indentUnit + headerLastIndentUnit
939 rep = Configurable._printHeader(headerIndent, title)
945 rep += indentStr +
'|-<no properties>' + os.linesep
949 for p
in props.keys():
950 nameWidth =
max(nameWidth, len(p))
951 for p, v
in props.items():
953 prefix = indentStr +
'|-%-*s' % (nameWidth, p)
955 if log.isEnabledFor(logging.DEBUG):
956 if v != Configurable.propertyNoValue:
957 address =
' @%11s' %
hex(id(v))
962 default = defs.get(p)
963 if v == Configurable.propertyNoValue:
965 strVal = repr(default)
969 if hasattr(v,
"getGaudiHandle"):
970 vv = v.getGaudiHandle()
973 if isinstance(vv, GaudiHandle)
or isinstance(
974 vv, GaudiHandleArray):
977 if hasattr(default,
"toStringProperty"):
978 strDef = repr(default.toStringProperty())
980 strDef = repr(default)
981 if strDef == repr(vv.toStringProperty()):
985 strDef = repr(default)
987 line = prefix +
' = ' + strVal
989 if strDef
is not None:
991 if len(line) + len(strDef) > Configurable.printHeaderWidth:
992 line += os.linesep + indentStr +
'| ' + \
993 (len(prefix) - len(indentStr) - 3) *
' ' 994 line +=
' (default: %s)' % (strDef, )
996 rep += line + os.linesep
1008 rep += cfg.__str__(indent + 1,
'|=') + os.linesep
1011 rep += Configurable._printFooter(indentStr, title)
1016 Return True is the instance can be "applied". 1017 Always False for plain Configurable instances 1018 (i.e. not ConfigurableUser). 1034 object.__setattr__(obj, self.
__name__, value)
1041 Configurable.__init__(self, name)
1050 return 'GenericComponent' 1061 super(ConfigurableGeneric, self).
__setattr__(name, value)
1065 if isinstance(value, Configurable):
1066 self.__dict__[name] = value
1070 if not name
in self._properties:
1072 self._properties[name].__set__(self, value)
1086 'AuditAlgorithms': 0,
1087 'AuditInitialize': 0,
1088 'AuditReinitialize': 0,
1094 super(ConfigurableAlgorithm, self).
__init__(name)
1115 elif rhs
is CFFalse:
1117 return AndNode(self, rhs)
1124 return OrNode(self, rhs)
1127 return InvertNode(self)
1130 return OrderedNode(self, rhs)
1141 return (repr(self) == repr(other))
1144 """Return a unique identifier for this object. 1146 As we use the `repr` of this object to check for equality, we use it 1147 here to define uniqueness. 1150 return hash((repr(self), ))
1157 'AuditInitialize': 0,
1168 return iService(self.
_name)
1187 'AuditInitialize': 0,
1192 super(ConfigurableAlgTool, self).
__init__(name)
1193 if '.' not in self.
_name:
1197 name = name[name.find(
'/') + 1:]
1219 return pop + Configurable.getPrintTitle(self)
1228 if isinstance(c, ConfigurableAlgTool):
1229 c.setParent(parentName)
1233 name = name[name.rfind(
'.') + 1:]
1264 name = name[name.rfind(
'.') + 1:]
1265 return str(self.
getType() +
'/' + name)
1272 __slots__ = {
'_jobOptName': 0,
'OutputLevel': 0,
'Enable': 1}
1275 super(ConfigurableAuditor, self).
__init__(name)
1277 name = name[name.find(
'/') + 1:]
1299 "__used_instances__": [],
1311 __used_configurables__ = []
1314 __queried_configurables__ = []
1316 def __init__(self, name=Configurable.DefaultName, _enabled=True, **kwargs):
1317 super(ConfigurableUser, self).
__init__(name)
1318 for n, v
in kwargs.items():
1336 if type(used)
is tuple:
1337 used, used_name = used
1341 if type(used)
is str:
1342 used_class = confDbGetConfigurable(used)
1347 inst = used_class(name=used_name, _enabled=
False)
1348 except AttributeError:
1352 inst = used_class(name=used_name)
1356 if type(queried)
is str:
1357 queried = confDbGetConfigurable(used)
1358 inst = queried(_enabled=
False)
1359 except AttributeError:
1365 Declare that we are going to modify the Configurable 'other' in our 1366 __apply_configuration__. 1369 if hasattr(other,
"__users__"):
1370 other.__users__.append(self)
1374 Declare that we are going to retrieve property values from the 1375 ConfigurableUser 'other' in our __apply_configuration__. 1377 if not isinstance(other, ConfigurableUser):
1379 "'%s': Cannot make passive use of '%s', it is not a ConfigurableUser" 1380 % (self.
name(), other.name()))
1381 other.__addActiveUseOf(self)
1395 Remove this ConfigurableUser instance from the users list of the used 1401 used.__users__.remove(self)
1405 Propagate the property 'name' (if set) to other configurables (if possible). 1408 propagate to all the entries in __used_configurables__ 1409 a configurable instance: 1410 propagate only to it 1411 list of configurable instances: 1412 propagate to all of them. 1416 - if the local property is set, the other property will be overwritten 1417 - local property not set and other set => keep other 1418 - local property not set and other not set => overwrite the default for 1419 ConfigurableUser instances and set the property for Configurables 1424 elif type(others)
not in [list, tuple]:
1430 for other
in [o
for o
in others
if name
in o.__slots__]:
1433 if other.isPropertySet(name):
1435 "Property '%(prop)s' is set in both '%(self)s' and '%(other)s', using '%(self)s.%(prop)s'" 1437 "self": self.
name(),
1438 "other": other.name(),
1441 other.setProp(name, value)
1443 elif not other.isPropertySet(name):
1444 if isinstance(other, ConfigurableUser):
1445 otherType =
type(other._properties[name].getDefault())
1446 other._properties[name].setDefault(value)
1447 if otherType
in [list, dict]:
1450 other.setProp(name, otherType(value))
1452 other.setProp(name, value)
1457 Call propagateProperty for each property listed in 'names'. 1458 If 'names' is None, all the properties are propagated. 1462 names = [p
for p
in self.
__slots__ if not p.startswith(
"_")]
1468 Function to be overridden to convert the high level configuration into a 1470 The default implementation calls applyConf, which is the method defined 1471 in some ConfigurableUser implementations. 1477 Function to be overridden to convert the high level configuration into a 1484 Function used to define the name of the private instance of a given class 1486 This method is used when the __used_configurables_property__ declares the 1487 need of a private used configurable without specifying the name. 1489 if type(cls)
is str:
1492 clName = cls.__name__
1493 return "%s_%s" % (self.name(), clName)
1497 Return the used instance with a given name. 1500 if i.name() == name:
1501 if hasattr(i,
"_enabled"):
1506 raise KeyError(name)
1510 Return True is the instance can be "applied". 1516 postConfigActions = []
1521 Add a new callable ('function') to the list of post-configuration actions. 1522 If the callable is already in the list, it is moved to the end of the list. 1523 The list is directly accessible as 'GaudiKernel.Configurable.postConfigActions'. 1526 postConfigActions.remove(function)
1529 postConfigActions.append(function)
1534 Remove a callable from the list of post-config actions. 1535 The list is directly accessible as 'GaudiKernel.Configurable.postConfigActions'. 1537 postConfigActions.remove(function)
1540 _appliedConfigurableUsers_ =
False 1545 Call the apply method of all the ConfigurableUser instances respecting the 1546 dependencies. First the C.U.s that are not used by anybody, then the used 1547 ones, when they are not used anymore. 1550 global _appliedConfigurableUsers_, postConfigActions
1551 if _appliedConfigurableUsers_:
1553 _appliedConfigurableUsers_ =
True 1555 def applicableConfUsers():
1557 Generator returning all the configurables that can be applied in the 1558 order in which they can be applied. 1570 yield next(c
for c
in Configurable.allConfigurables.values()
1571 if c.isApplicable())
1573 debugApplyOrder =
'GAUDI_DUBUG_CONF_USER' in os.environ
1574 for c
in applicableConfUsers():
1576 log.info(
"applying configuration of %s", c.name())
1578 sys.stderr.write(
'applying %r' % c)
1579 c.__apply_configuration__()
1582 log.info(
"skipping configuration of %s", c.name())
1584 if hasattr(c,
"__detach_used__"):
1590 c
for c
in Configurable.allConfigurables.values()
if 1591 hasattr(c,
'__apply_configuration__')
and c._enabled
and not c._applied
1595 raise Error(
"Detected loop in the ConfigurableUser" 1596 " dependencies: %r" % [c.name()
for c
in leftConfUsers])
1599 unknown = set(Configurable.allConfigurables)
1603 log.debug(
'new configurable created automatically: %s', k)
1605 Configurable.allConfigurables[k].
properties()
1609 for action
in postConfigActions:
1615 Obsolete (buggy) implementation of applyConfigurableUsers(), kept to provide 1616 backward compatibility for configurations that where relying (implicitly) on 1617 bug #103803, or on a specific (non guaranteed) order of execution. 1619 @see applyConfigurableUsers() 1622 global _appliedConfigurableUsers_, postConfigActions
1623 if _appliedConfigurableUsers_:
1625 _appliedConfigurableUsers_ =
True 1627 debugApplyOrder =
'GAUDI_DUBUG_CONF_USER' in os.environ
1629 c
for c
in Configurable.allConfigurables.values()
1630 if hasattr(c,
"__apply_configuration__")
1633 while applied
and confUsers:
1637 if hasattr(c,
"__users__")
and c.__users__:
1638 newConfUsers.append(c)
1643 enabled = (
not hasattr(c,
"_enabled"))
or c._enabled
1645 log.info(
"applying configuration of %s", c.name())
1647 sys.stderr.write(
'applying %r' % c)
1648 c.__apply_configuration__()
1651 log.info(
"skipping configuration of %s", c.name())
1652 if hasattr(c,
"__detach_used__"):
1655 confUsers = newConfUsers
1658 raise Error(
"Detected loop in the ConfigurableUser " 1659 " dependencies: %r" % [c.name()
for c
in confUsers])
1662 unknown = set(Configurable.allConfigurables)
1666 log.debug(
'new configurable created automatically: %s', k)
1668 Configurable.allConfigurables[k].
properties()
1672 for action
in postConfigActions:
1678 Function to select all and only the configurables that have to be used in 1679 GaudiPython.AppMgr constructor. 1680 This is needed because in Athena the implementation have to be different (the 1681 configuration is used in a different moment). 1684 k
for k, v
in Configurable.allConfigurables.items()
1685 if v.getGaudiType() !=
"User")
1690 Clean up all configurations and configurables. 1692 for c
in Configurable.allConfigurables.values():
1693 c.__class__.configurables.clear()
1694 Configurable.allConfigurables.clear()
1697 ConfigurableGeneric.configurables.clear()
1698 from .ProcessJobOptions
import _included_files
1701 for file
in _included_files:
1702 dirname, basname = os.path.split(file)
1703 basname, ext = os.path.splitext(basname)
1704 if basname
in sys.modules:
1705 del sys.modules[basname]
1706 _included_files.clear()
1715 return self.
stack[-1]
1723 name = prefix + str(cnt)
1724 while name
in allConfigurables:
1726 name = prefix + str(cnt)
1730 from Configurables
import GaudiSequencer
1735 if visitee
in (CFTrue, CFFalse):
1736 stack.append(self.
_newSeq(Invert=visitee
is CFFalse))
1737 elif isinstance(visitee, (ControlFlowLeaf, ConfigurableAlgorithm)):
1738 stack.append(visitee)
1739 elif isinstance(visitee, (OrNode, AndNode, OrderedNode)):
1744 ModeOR=isinstance(visitee, OrNode),
1745 ShortCircuit=
not isinstance(visitee, OrderedNode),
1748 elif isinstance(visitee, ignore):
1749 if hasattr(stack[-1],
'IgnoreFilterPassed'):
1750 stack[-1].IgnoreFilterPassed =
True 1754 Members=[stack.pop()], IgnoreFilterPassed=
True))
1755 elif isinstance(visitee, InvertNode):
1756 if hasattr(stack[-1],
'Invert'):
1757 stack[-1].Invert =
True 1759 stack.append(self.
_newSeq(Members=[stack.pop()], Invert=
True))
1764 Convert a control flow expression to nested GaudiSequencers. 1766 if not isinstance(expression, ControlFlowNode):
1767 raise ValueError(
'ControlFlowNode instance expected, got %s' %
1768 type(expression).__name__)
1770 expression.visitNode(visitor)
1771 return visitor.sequence
1776 Helper class to use a ControlFlowNode as an algorithm configurable 1783 if name
in Configurable.allConfigurables:
1784 instance = Configurable.allConfigurables[name]
1785 assert type(instance)
is cls, \
1786 (
'trying to reuse {0!r} as name of a {1} instance while it''s ' 1787 'already used for an instance of {2}').
format(
1790 type(instance).__name__)
1793 instance = super(SuperAlgorithm, cls).
__new__(cls)
1794 Configurable.allConfigurables[name] = instance
1801 setattr(self, key, kwargs[key])
1826 Instantiate and algorithm of type 'typ' with a name suitable for use 1827 inside a SuperAlgorithm. 1829 name =
'{0}_{1}'.
format(self.
name, kwargs.pop(
'name', typ.getType()))
1830 return typ(name, **kwargs)
1833 raise NotImplementedError()
1840 self.
graph.visitNode(visitor)
1843 super(SuperAlgorithm, self).
__setattr__(name, value)
1844 if name
in (
'_name',
'graph'):
1848 class PropSetter(object):
1849 def enter(self, node):
1851 setattr(node, name, value)
1852 except (ValueError, AttributeError):
1856 def leave(self, node):
1859 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)