Fix error for negative n_processes input in MultiprocessingEvaluator#189
Merged
EwoutH merged 1 commit intoquaquel:masterfrom Oct 5, 2022
Merged
Fix error for negative n_processes input in MultiprocessingEvaluator#189EwoutH merged 1 commit intoquaquel:masterfrom
n_processes input in MultiprocessingEvaluator#189EwoutH merged 1 commit intoquaquel:masterfrom
Conversation
PR quaquel#140 introduced a feature for the MultiprocessingEvaluator to take a negative input for n_processes, which initialize the evaluator with the cpu_count minus that negative integer, leaving that number of cores free. In 7dd1610 this code was refactored, introducing a bug that broke the negative-integer input functionality. When a negative integer is inputted, a AttributeError: 'MultiprocessingEvaluator' object has no attribute 'n_processes' was created. The bug was caused by self.n_processes begin used instead of n_processes, where in earlier code self.n_processes was set equal to n_processes earlier in the process. This commit fixes this behaviour by using n_processes to calculate self.n_processes. Unfortunately this bug landed in the EMAworkbench 2.2.0 release. A cherry pick and new patch release should be considered.
quaquel
approved these changes
Oct 5, 2022
Owner
|
The code change itself is fine, but I noticed the docs are not building because of an outdated reference to a requirements file. Any idea what is going on with that? |
Collaborator
Author
|
Thanks for reviewing. Yes, I noticed that as well. I opened a PR to fix it upstream (readthedocs/readthedocs.org#9642), if that proves non-trivial I will fix it in our own configuration (it’s a single line of code in the Shall I create a draft-release for 2.2.1 with the bug fixes listed above? |
Owner
|
yes go ahead with the bug fix release |
EwoutH
added a commit
that referenced
this pull request
Oct 6, 2022
PR #140 introduced a feature for the MultiprocessingEvaluator to take a negative input for n_processes, which initialize the evaluator with the cpu_count minus that negative integer, leaving that number of cores free. In 7dd1610 this code was refactored, introducing a bug that broke the negative-integer input functionality. When a negative integer is inputted, a AttributeError: 'MultiprocessingEvaluator' object has no attribute 'n_processes' was created. The bug was caused by self.n_processes begin used instead of n_processes, where in earlier code self.n_processes was set equal to n_processes earlier in the process. This commit fixes this behaviour by using n_processes to calculate self.n_processes.
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.
PR #140 introduced a feature for the MultiprocessingEvaluator to take a negative input for
n_processes, which initialize the evaluator with thecpu_countminus that negative integer, leaving that number of cores free.In 7dd1610 this code was refactored, introducing a bug that broke the negative-integer input functionality. When a negative integer is inputted, a
AttributeError: 'MultiprocessingEvaluator' object has no attribute 'n_processes'was created.The bug was caused by
self.n_processesbegin used instead ofn_processes, where in earlier codeself.n_processeswas set equal ton_processesearlier in the process.This commit fixes this behaviour by using
n_processesto calculateself.n_processes.Closes #188.
Unfortunately this bug landed in the EMAworkbench 2.2.0 release. I would suggest creating a small bugfix release 2.2.1, in which we include the fixes for this issue (#188), the fix (#161) for the prim logging bug (#155) and the fix (b25f9bd+#183) for the 3-dimensional output saving issue (#168).