fixed sorting of evalFuncs when passed as kwargs #249
Merged
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.
Purpose
The
evalFuncs
argument inevalFunctions()
andevalFunctionsSens()
is casted to a sorted list in several parts ofbaseclasses.AeroProblem
andpyAdflow
, except when the functions are passed as kwarg inpyADflow.evalFuncs()
- see this line.This creates issues when the
evalFuncs
kwarg is passed as a set in a multi-processor run. Python sets indeed do not preserve ordering within the iterable object, so when the function values are gathered from different procs in a for loop over the list index, the values of different functions will be mixed together.This PR addresses this by casting the problematic list to a sorted list.
Expected time until merged
Not much, I do not think a test is necessary here.
Type of change
Testing
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable