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
Provide a way for the plugin writer to silence warnings from downloaders #1592
Conversation
ef3bb2e
to
b04d367
Compare
Attached issue: https://pulp.plan.io/issues/9317 |
b04d367
to
69c8839
Compare
This does not cover 404s because there is no need to retry. Right? |
69c8839
to
def4aac
Compare
@mdellweg It covers 404s as well. That counts as a "failure" it just happens immediately and doesn't attempt to retry. Basically if The purpose is we sometimes try to download files that are optional and not guaranteed to be there, so we don't want to log errors in the event that they are not. Here's a plugin example: pulp/pulp_rpm#2112 |
That sounds great. Attempting to download metadata that might be there can be quite common. |
@@ -234,6 +234,7 @@ async def run(self, extra_data=None): | |||
|
|||
Args: | |||
extra_data (dict): Extra data passed to the downloader. | |||
quiet (bool): Don't log on backoff or failure events. |
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 want to think this over some. This is a leakly abstraction because base has no notion of backoff events, that's a pure HTTPDownloader thing.
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.
We could use *args
and **kwargs
instead. I didn't want to do that, because it might tempt passing them on to _run()
, which would be improper.
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.
We keep running into this pattern actually. Maybe we should just put *args
and **kwargs
onto BaseDownloader
How can we integrate this with the existing |
Like this actually? Maybe your Pr should replace this usage? |
@bmbouter I think raising exceptions is necessary for the backoffs to occur properly though, so we can't touch that. Backoff expects exceptions to be thrown when it fails and checks those exceptions to decide what to do next. It actually covers a separate use case because we don't want to touch the mechanism of the download at all, just avoid logging it. |
I think I'm still slow from coming back from paternity. When I read "The purpose is we sometimes try to download files that are optional and not guaranteed to be there, so we don't want to log errors in the event that they are not." I think to myself that is why we made the |
@bmbouter You know, I think this actually does work, but I'm still kind of confused about the mechanism. I'll spend a few minutes digging into the code and then close this PR if it turns out we don't need it. edit: I think this is probably OK. |
closes: #9317
https://pulp.plan.io/issues/9317