Skip to content
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

improve stability of ctx.add_basemap() #248

Merged
merged 2 commits into from
Aug 13, 2024
Merged

improve stability of ctx.add_basemap() #248

merged 2 commits into from
Aug 13, 2024

Conversation

veenstrajelmer
Copy link
Contributor

@veenstrajelmer veenstrajelmer commented Aug 9, 2024

Fixes #247

Changed:

  • made sure all HTTPErrors are captured and retried
  • included the last error/reason message when max_retries is reached

The code in this contribution catches all HTTPErrors and therefore makes it impossible that the code continue with None in the arrays list. This used to cause varying errors related to None, depending on whether the first in the arrays list was None or not, or any of the others. By capturing all HTTPErrors, the code is redirected to retrying instead of that the _retryer() function returns None. After max_retries is reached, the user now gets a informative error message. The format of the message is based on what request.raise_for_status() would return.

The current code proves useful, these were the error messages during the manual tests:

  • HTTPError: Connection reset by peer too many times. Last message was: 502 Error: Bad Gateway for url: https://a.tile.openstreetmap.fr/hot/10/812/458.png
  • 500 Error (forgot to copy this one when it occurred

@martinfleis could you review this PR?

…last error/reason message when max_retries is reached
@veenstrajelmer
Copy link
Contributor Author

veenstrajelmer commented Aug 12, 2024

I see some of the tests are failing because of os.wait() already taken care of in #245. But that PR also has failing tests related to this PR. If you would merge #245 I can update the branch if required, but if you have a different idea about it, please feel free to let me know or take over.

@martinfleis
Copy link
Member

I've merged #245, you can try updating this one

@veenstrajelmer
Copy link
Contributor Author

The branch/fork was synced, but I think you have to approve the test workflow to be kicked off again.

@martinfleis
Copy link
Member

I believe that the remaining failures are not related.

Copy link
Member

@martinfleis martinfleis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a way of testing this easily so let's say this is fine as is, unless you want to tweak it further.

@veenstrajelmer
Copy link
Contributor Author

Ok, in that case please go ahead with merging the PR. Thanks for your consideration. I would like to update the minimal contextily version in my pyproject.toml once this fix is released. Is it already know when there will be a new release or not yet?

@martinfleis martinfleis merged commit cda9ee2 into geopandas:main Aug 13, 2024
1 of 8 checks passed
@martinfleis
Copy link
Member

I'll cut the patch release today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Several errors with ctx.add_basemap()
2 participants