![]() |
ATLAS Offline Software
|
Public Member Functions | |
| def | __init__ (self) |
| def | setBlockName (self, name) |
| def | getBlockName (self) |
| def | factoryName (self) |
| def | setFactoryName (self, name) |
| def | instanceName (self) |
| def | isUsedForConfig (self, config) |
| def | applyConfigOverrides (self, config) |
| def | addDependency (self, dependencyName, required=True) |
| def | hasDependencies (self) |
| def | getDependencies (self) |
| def | addOption (self, name, defaultValue, *type, info='', noneAction='ignore', required=False, expertMode=None) |
| def | setOptionValue (self, name, value) |
| def | getOptionValue (self, name) |
| def | getOptions (self) |
| def | printOptions (self, verbose=False, width=60, indent=" ") |
| def | hasOption (self, name) |
| def | __eq__ (self, blockName) |
| def | __str__ (self) |
| def | get_instance_count (cls) |
| def | checkExpertSettings (self, config) |
| def | __new__ (cls, name, bases, dct) |
Static Public Attributes | |
| dictionary | instance_counts = {} |
Private Member Functions | |
| def | _is_expert_value (self, rule, value) |
Private Attributes | |
| _blockName | |
| _factoryName | |
| _dependencies | |
| _options | |
| _expertModeSettings | |
the base class for classes implementing individual blocks of configuration A configuration block is a sequence of one or more algorithms that should always be scheduled together, e.g. the muon four momentum corrections could be a single block, muon selection could then be another block. The blocks themselves generally have their own configuration options/properties specific to the block, and will perform a dynamic configuration based on those options as well as the overall job. The actual configuration of the algorithms in the block will depend on what other blocks are scheduled before and afterwards, most importantly some algorithms will introduce shallow copies that subsequent algorithms will need to run on, and some algorithms will add selection decorations that subquent algorithms should use as preselections. The algorithms get created in a multi-step process (that may be extended in the future): As a first step each block retrieves references to the containers it uses (essentially marking its spot in the processing chain) and also registering any shallow copies that will be made. In the second/last step each block then creates the fully configured algorithms. One goal is that when the algorithms get created they will have their final configuration and there needs to be no meta-configuration data attached to the algorithms, essentially an inversion of the approach in AnaAlgSequence in which the algorithms got created first with associated meta-configuration and then get modified in susequent configuration steps. For now this is mostly an empty base class, but another goal of this approach is to make it easier to build another configuration layer on top of this one, and this class will likely be extended and get data members at that point. The child class needs to implement the method `makeAlgs` which is given a single `ConfigAccumulator` type argument. This is meant to create the sequence of algorithms that this block configures. This is currently (28 Jul 2025) called twice and should do the same thing during both calls, but the plan is to change that to a single call. The child class should also implement the method `getInstanceName` which should return a string that is used to distinguish between multiple instances of the same block. This is used to append the instance name to the names of all algorithms created by this block, and may in the future also be used to distinguish between multiple instances of the block.
Definition at line 92 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.__init__ | ( | self | ) |
Definition at line 147 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.__eq__ | ( | self, | |
| blockName | |||
| ) |
Implementation of == operator. Used for seaching configSeque. E.g. if blockName in configSeq:
Definition at line 419 of file ConfigBlock.py.
|
inherited |
Definition at line 53 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.__str__ | ( | self | ) |
Definition at line 427 of file ConfigBlock.py.
|
private |
Check whether value matches an expert mode rule. Rule can be: - A literal (compared with ==) - A callable predicate (called with value) - A special marker string (common callable)
Definition at line 436 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.addDependency | ( | self, | |
| dependencyName, | |||
required = True |
|||
| ) |
Add a dependency for the block. Dependency is corresponds to the blockName of another block. If required is True, will throw an error if dependency is not present; otherwise will move this block after the required block. If required is False, will do nothing if required block is not present; otherwise, it will move block after required block.
Definition at line 291 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.addOption | ( | self, | |
| name, | |||
| defaultValue, | |||
| * | type, | ||
info = '', |
|||
noneAction = 'ignore', |
|||
required = False, |
|||
expertMode = None |
|||
| ) |
declare the given option on the configuration block This should only be called in the constructor of the configuration block. NOTE: The backend to option handling is slated to be replaced at some point. This particular function should essentially stay the same, but some behavior may change.
Definition at line 314 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.applyConfigOverrides | ( | self, | |
| config | |||
| ) |
Apply any configuration overrides specified in the block's `propertyOverrides` option. This is meant to be called at the end of the configuration process, after all algorithms have been created and configured.
Definition at line 266 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.checkExpertSettings | ( | self, | |
| config | |||
| ) |
Check if any settings require expert mode and validate accordingly. If any setting is set to a value that requires expert mode but we're not in expert mode, raise an error.
Definition at line 458 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.factoryName | ( | self | ) |
get the factory name for this block This is mostly to give a reliable means of identifying the type of block we have in error messages. This is meant to be automatically set by the factory based on the requested block name, but there are a number of fallbacks. It is best not to assume a specific format, this is mostly meant to be used as an identifier in output messages.
Definition at line 207 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.get_instance_count | ( | cls | ) |
Definition at line 432 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.getBlockName | ( | self | ) |
Get blockName
Definition at line 203 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.getDependencies | ( | self | ) |
Return the list of dependencies.
Definition at line 310 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.getOptions | ( | self | ) |
Return a copy of the options associated with the block
Definition at line 382 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.getOptionValue | ( | self, | |
| name | |||
| ) |
Returns config option value, if present; otherwise return None
Definition at line 376 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.hasDependencies | ( | self | ) |
| def python.ConfigBlock.ConfigBlock.hasOption | ( | self, | |
| name | |||
| ) |
whether the configuration block has the given option WARNING: The backend to option handling is slated to be replaced at some point. This particular function may change behavior, interface or be removed/replaced entirely.
Definition at line 409 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.instanceName | ( | self | ) |
Get the name of the instance The name of the instance is used to distinguish between multiple instances of the same block. Most importantly, this will be appended to the names of all algorithms created by this block. This defaults to an empty string, but block implementations should override it with an appropriate name based on identifying options set on this instance. A typical example would be the name of the (main) container, plus potentially the selection or working point. Ideally all blocks should override this method, but for backward compatibility (28 Jul 25) it defaults to an empty string.
Definition at line 234 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.isUsedForConfig | ( | self, | |
| config | |||
| ) |
whether this block should be used for the given configuration This is used by `ConfigSequence` to determine whether this block should be included in the configuration.
Definition at line 251 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.printOptions | ( | self, | |
verbose = False, |
|||
width = 60, |
|||
indent = " " |
|||
| ) |
| def python.ConfigBlock.ConfigBlock.setBlockName | ( | self, | |
| name | |||
| ) |
Set blockName
Definition at line 199 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.setFactoryName | ( | self, | |
| name | |||
| ) |
set the factory name for this block This is meant to be called automatically by the factory based on the requested block name. If you are creating a block without a factory, you can call this method to set the factory name manually.
Definition at line 225 of file ConfigBlock.py.
| def python.ConfigBlock.ConfigBlock.setOptionValue | ( | self, | |
| name, | |||
| value | |||
| ) |
set the given option on the configuration block NOTE: The backend to option handling is slated to be replaced at some point. This particular function should essentially stay the same, but some behavior may change.
Definition at line 349 of file ConfigBlock.py.
|
private |
Definition at line 148 of file ConfigBlock.py.
|
private |
Definition at line 150 of file ConfigBlock.py.
|
private |
Definition at line 152 of file ConfigBlock.py.
|
private |
Definition at line 149 of file ConfigBlock.py.
|
private |
Definition at line 151 of file ConfigBlock.py.
|
static |
Definition at line 145 of file ConfigBlock.py.
1.8.18