Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error for negative n_processes input in MultiprocessingEvaluator #189

Merged
merged 1 commit into from
Oct 5, 2022

Conversation

EwoutH
Copy link
Collaborator

@EwoutH EwoutH commented Oct 5, 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.

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).

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.
@EwoutH EwoutH added the bug label Oct 5, 2022
@EwoutH EwoutH added this to the 2.2.1 milestone Oct 5, 2022
@EwoutH EwoutH requested a review from quaquel October 5, 2022 18:44
@coveralls
Copy link

Coverage Status

Coverage remained the same at 81.585% when pulling 1f68019 on EwoutH:n_processes_fix into 9348d3c on quaquel:master.

@quaquel
Copy link
Owner

quaquel commented Oct 5, 2022

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?

@EwoutH
Copy link
Collaborator Author

EwoutH commented Oct 5, 2022

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 .readthedocs.yaml).

Shall I create a draft-release for 2.2.1 with the bug fixes listed above?

@EwoutH EwoutH merged commit 4385b12 into quaquel:master Oct 5, 2022
@quaquel
Copy link
Owner

quaquel commented Oct 5, 2022

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Negative input values for n_processes in the MultiprocessingEvaluator result in fatal errors
3 participants