fix: wrap p_imap result with list() to prevent TypeError#677
Open
thakoreh wants to merge 1 commit intoSALib:mainfrom
Open
fix: wrap p_imap result with list() to prevent TypeError#677thakoreh wants to merge 1 commit intoSALib:mainfrom
thakoreh wants to merge 1 commit intoSALib:mainfrom
Conversation
…evaluation When p_tqdm is available and multiple cores are used, p_imap returns a generator that cannot be properly consumed by _collect_results(). Fixes SALib#676
Member
|
That's a first I think. Before doing anything, I think we need a AI policy. I suggest taking the one from SymPy and LLVM. What we need is some official disclosure on all PRs. Otherwise we are at risk of breaking our licensing and copyright guarantees. And of course quality. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #676
When
p_tqdmis available and multiple cores are used for parallel evaluation,p_imapreturns a generator that cannot be properly consumed by_collect_results().Change
Wrap the
p_imap()call withlist()inevaluate_parallel()(line 238 ofsrc/SALib/util/problem.py).Test Plan
Added
tests/test_ptqdm_fix.pywith 3 tests:test_evaluate_with_ptqdm_returns_consumable_results— mocks p_imap as a generator, verifies results are consumed correctlytest_evaluate_without_ptqdm_still_works— regression test for non-p_tqdm pathtest_evaluate_single_core_no_ptqdm— single-core fallbackAll tests pass.
Verification