fix: prevents exception when the pipeline contains multiple nested loops #8677
+55
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The cycle detection/breaking algorithm (PipelineBase::_break_supported_cycles_in_graph()) was raising exceptions in some situations for pipelines that contained nested loops. This was happening because the algorithm was trying to remove the same edge multiple times from the graph.
Related Issues
Proposed Changes:
How did you test it?
Notes for the reviewer
The current PR fixes the reported problem. However, it was clear during my tests that the current algorithm to break cycles is not deterministic (due to the undeterministic order of the dictionaries/lists it iterates on, in the presence of multiple Variadic and/or Optional inputs). I don't have enough knowledge at the moment to assess if this is really a problem, but my hunch is that in some situations, where multiple nodes with Variadic and/or Optional inputs are present, the end result of the pipeline execution might become undeterministic as well. Since this was not the point/scope of this ticket, I did not try to change that, but it might warrant a separate ticket/investigation.
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
and added!
in case the PR includes breaking changes.