-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Force --fatal=warnings|errors
to honor LOG_FILTER
#2856
base: main
Are you sure you want to change the base?
Force --fatal=warnings|errors
to honor LOG_FILTER
#2856
Conversation
You can have empty alts, nothing prevents that. |
@avaris yes, absolutely, but this would allow for a use case where the warnings wouldn't even be emitted, such that |
Ah I see. I can't test right now but if filtered warnings trigger |
--fatal=warnings|errors
to honor LOG_FILTER
@avaris I didn't update the original branch name, but I refactored this now to not add an additional feature and was curious if this was more of what you had in mind? |
"Yes" on the idea, "not sure" on the implementation :). I was thinking somewhere along the lines of implementing |
I'm curious what is seen as the main benefit of that approach (because it's one I haven't seen before)? :) |
I'm just not sure about terminating in the middle of handler queue. If more handlers are added after |
Given this latest response, I feel like I might be missing the meaning of 'fatal' in the context of Pelican. I was trying to follow:
Immediately exiting seems to be in line with best practices around 'fatal' things in different languages/platforms, so I'm a bit confused. Right now the existing behavior looks like this when I run it:
When a
Any original messages are dropped and this returns an exit code of 1. And with the patch it looks like:
What do you think about moving forward with this patch to address the one, specific interaction of |
Maybe I wasn't good at explaining myself. Your PR fixes the issue of I'm talking more about when and how to exit (+ the purpose of logging). I'm assuming when you set About the $ pelican -s pelicanconf.py --fatal=warnings
WARNING: Empty alt attribute for image logo.png in /home/avaris/ws/test/content/article.md
ERROR: Could not process ./article.md
| Warning encountered
CRITICAL: Error encountered and here is your PR $ pelican -s pelicanconf.py --fatal=warnings
WARNING: Empty alt attribute for image logo.png in /home/avaris/ws/test/content/article.md First one is more clear. Warning happened, so process shut down. Second one is a bit vague. Warning is written then suddenly process exited. You don't even get a clear picture of "failure" unless you check the exit code. Sure one could look at |
Ahh, I see. I was approaching it from the other side (getting
I didn't consider that information to be helpful beyond the original Would you prefer that I close this PR and submit this as an issue instead so that more community feedback can be gathered about the desired UX? |
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.
I'm still not very happy about sys.exit
but this does solve the issue in question, so I'm approving it :), thanks!
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.
Thanks for the enhancement, Eric. Would you please have a look at the two minor suggestions I made, and assuming they make sense to you, would you make those changes and rebase & squash your commits?
@@ -194,11 +179,13 @@ def get_formatter(): | |||
return TextFormatter() | |||
|
|||
|
|||
class FatalHandler(logging.Handler): | |||
def emit(self, record): | |||
sys.exit(1) |
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.
Very minor suggestion, but perhaps change sys.exit(1)
to the following?
raise SystemExit(1)
@@ -163,7 +163,7 @@ def load_source(name, path): | |||
'WRITE_SELECTED': [], | |||
'FORMATTED_FIELDS': ['summary'], | |||
'PORT': 8000, | |||
'BIND': '127.0.0.1', | |||
'BIND': '127.0.0.1' |
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.
Unless this change is somehow related to the other changes in this pull request, I suggest that this change be reverted.
Hi @ericrdunham. Is there any chance you'd be willing to resolve the merge conflict here so we can get your Pelican contribution merged? 😊 |
Hi @ericrdunham. Following up again to see if you'd be willing to resolve the merge conflict here so we can get your Pelican contribution merged? 😊 |
Hey Eric. Just following up one last time so we can get your contribution merged. Any chance you could make the above changes and resolve the conflicts here? |
Pull Request Checklist