Skip to content

Bugfix for !76836: common options for sub-blocks in YAML CP algorithms

Baptiste Ravina requested to merge ravinab/athena:fix_python_dict into main

!76836 (merged) added some logic to the _configureAlg method in ConfigText.py, to make sure that the options ["skipOnData", "skipOnMC", "onlyForDSIDs"] would be passed on to sub-blocks (via the dictionary extraOptions), in the configuration stage of CP algorithms / config blocks.

This introduced a bug when there are more than 1 sub-block, as follows:

  • the mother config block has extraOptions set to None, which triggers the retrieval of the options ["skipOnData", "skipOnMC", "onlyForDSIDs"] if they are set to non-default values
  • the first daughter sub-block then sees a non-null extraOptions, which triggers the line
algOpts = seq.setOptions(extraOptions)

This is where the bug lies: extraOptions is modified by seq.setOptions, and in particular is extended with all the options of the first daughter sub-block

  • when the second daughter sub-block is configured, extraOptions contains not only the correct options from ["skipOnData", "skipOnMC", "onlyForDSIDs"] but also the full configuration of the second daughter sub-block. The same call to
algOpts = seq.setOptions(extraOptions)

will then lead to a crash on duplicated algorithm names.

The simplest fix is to simply pass a copy of the extraOptions dictionary to seq.setOptions,

algOpts = seq.setOptions(extraOptions.copy())

Merge request reports

Loading