BUG: Fixed bug in WL ensemble by replacing logger.warning by warnings.warn.
Description
The fact that a icet.input_output.logging_tools.logger
instance is initiated when a WangLandauEnsemble
is created makes it possible that some processes might hang, when running multiple WL simulations in parallel using the multiprocessing
module, for the reasons detailed in this bug report. It is, therefore, better to use warnings.warn
, instead of creating logger
and issuing a logger.warning
, to notify the user that a simulation has converged.
Summary of changes
- The logger has been removed
-
The
warnings
module is imported instead oficet.input_output.logging_tools.logger
. - The fact that a simulation has converged is conveyed by printing a
warnings.warn
message instead of issuing alogger.warning
. - In the unit test, there is no longer a need for importing and setting up a
logger
. - A test has been introduced to check that the correct warning message is produced if the simulation has already converged.
To consider
Before submitting your merge request make sure that licenses that might apply to the code that is being submitted are compliant with the license used for this code base. By submitting your code to this repository you also agree that your code will be distributed as part of this code base under the license conditions that apply.
Instructions for code review
Please make sure
- all new code is tested (and works obviously)
- all new code is documented; examples are strongly encouraged
- all new code is type hinted (Note: Type hints are automatically rendered in the documentation when they appear in function/method docstrings; parameter descriptions in class docstrings must be annotated explicitly.)
- variable and function names are in
snake_case
while class names are inCamelCase
- imports are in alphabetical order both with respect to module names and imported members; core library imports come first in a separate block;
import
lines go beforefrom
lines (This is done to allow other contributors to quickly find imports.) - all "must-pass" jobs in the CI pass (which includes enforcing flake8 compliance); "can-fail" jobs do not deteriorate
- examples in the documentation use doctest (both sphinx and docstrings)
- code that is commented out should be removed (unless there are very good reasons not to)
- comments that are unclear (e.g., "this should work ..." or "I don't know whether this works ...") need to be resolved first
- todos should be resolved/avoided as much as possible
Closes #506 (closed)