Quiet logging from MESSAGE.initialize #946
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.
In message_ix v3.11.0, all items, including equations and variables, are initialized when a message_ix.Scenario is created, through MESSAGE.initialize. This is required for ixmp.IXMP4Backend, and also a necessary step towards #254.
However, with Scenarios that created with JDBCBackend/ixmp v3.10 or earlier, these items are already initialized by the ixmp_source/Java code, with 0 dimensions. This behaviour cannot be disabled or overridden. When MESSAGE.initialize() calls ixmp.model.base.Model.initialize_items(), it emits over 100 log messages at level WARNING like:
This PR adds a context manager that filters out these log messages.
How to review
PR checklist
Add, expand, or update documentation.