CPAlgorithms: re-ordering of blocks with dependencies
Config blocks that declare dependencies trigger a re-ordering of the ConfigSequence
. The code currently looks up the first index of a block in the sequence that matches the declared dependency, and checks it against the dependent block: if they are in the wrong order, the dependent block is moved to right after the block it depends on.
This breaks down when multiple instances of such blocks are configured. @adohnalo ran into exactly this issue, trying to set up 2 instances of the TriggerAnalysisSF
block and 2 instances of the OverlapRemoval
block (that TriggerAnalysisSF
depends on) with matching settings. The current re-ordering would yield:
- Overlap A
- Trigger A
- Trigger B
- Overlap B
i.e. both TriggerAnalysisSF
blocks are inserted after the first (by index) OverlapRemoval
block.
This MR instead looks up the last index of the dependency, yielding the correct ordering:
- Overlap A
- Overlap B
- Trigger A
- Trigger B