-
Notifications
You must be signed in to change notification settings - Fork 122
Logging message enhancement #606
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request enhances logging behavior by skipping warnings for offline devices during initialization checks and ensuring that warning messages for NumParam corrections are issued only once.
- New test cases for online/offline behavior in the initialization checker are added.
- Logging in parameter adjustments now issues warnings at most once.
- Device online status is integrated into condition checks for flag updates and adjustments.
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/test_services.py | Added tests to verify warning behavior for online and offline devices. |
tests/test_numparam.py | Introduced tests asserting a single warning issuance for parameter checks. |
andes/core/service.py | Modified condition checking to work only on online devices. |
andes/core/param.py | Updated logging messages to include a note that the warning is one-time. |
andes/core/discrete.py | Adjusted the lower/upper adjustment logic to account for device status. |
Files not reviewed (1)
- docs/source/release-notes.rst: Language not supported
Comments suppressed due to low confidence (1)
tests/test_numparam.py:16
- [nitpick] The test assertion depends on the exact log message text; since the warning now includes additional wording, consider using a regex or substring match that accommodates possible variations in the log output.
assert caplog.text.count("Non-zero parameter Line.x corrected to 1e-08.") == 1
I'm not sure why it's better to show the warning message only once for nonconforming inputs. In the input stage, when we add one device, When the second device |
A useful enhancement would be to show which device violated the property constraint. I didn't do it, because in order to do it, one parameter needs to access its owner and then access the idx field, which looked messy to me. Maybe we can revisit it. |
I add a notebook to explain this, https://github.com/CURENT/demo/blob/master/demo/logging/logging.ipynb:
It seems that when add a model manually after file loading, the property violation is not triggered. Indeed this is a very marginal feature, but I can handle this if helpful "which device violated the property constraint" |
In this example, in Input 8, I think a warning is desired, because it will
immediately alert the user to input issues. Suppressing the message creates
the possibility of omission. There should be a warning to each violation,
although I agree the information should be more rich.
Regards,
Hantao Cui
…On Thu, May 1, 2025, 11:06 PM Jinning Wang ***@***.***> wrote:
*jinningwang* left a comment (CURENT/andes#606)
<#606 (comment)>
I add a notebook to explain this,
https://github.com/CURENT/demo/blob/master/demo/logging/logging.ipynb:
- Property violation and auto correction is triggered ONLY in file
loading stage, for PSS/E and JSON files.
- Property violation and auto correction is not triggered for XLSX
file.
It seems that when add a model manually after file loading, the property
violation is not triggered.
Indeed this is a very marginal feature, but I can handle this if helpful
"which device violated the property constraint"
—
Reply to this email directly, view it on GitHub
<#606 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSNZA65JPFJOADPJNZF6NL24LOKRAVCNFSM6AAAAAB4AX3NL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNBWGIYTIOJTGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Thank you for your comment. I agree with your opinion and plan to implement the following enhancements:
Change 1 involves Change 2 involves the three file parsing modules. Let me know if I miss anything. |
Turning off the warning is not a great idea because some warnings are due to user omissions that need attention. The proposed change falls under the category of "fail silently" and is generally advised against. If the goal is to make the program less verbose, we can store all the warning messages somewhere and output a message at the end like this: ```There are warnings during the data parsing. To see all the warnings, do
|
Agree with you, but we might skip this feature for now. |
Now in this PR I only skip the InitChecker logging and limiter adjust for offline devices. |
does not meet the expected criteria, or 2) unused data is detected.