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

retry failed elevation tile download #4461

Merged
merged 5 commits into from
Dec 18, 2023
Merged

Conversation

nilsnolde
Copy link
Member

fixes #4425

except URLError as e:
LOGGER.critical(f"Download failed of elevation tile {tile.dir}/{tile.name}: {e.reason}")

download_status = DownloadStatus.FAILED
Copy link
Member Author

Choose a reason for hiding this comment

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

most of the diff is just wrapping the previous logic into a for loop, where we request 15 times maximum with increased sleeps in between (exponential back off), up to 4.5 hours until we give up. could give much earlier though :D

Comment on lines +260 to +262
try:
uncompressed = gz.read()
except Exception as e:
Copy link
Member Author

Choose a reason for hiding this comment

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

protect for corrupt downloads

Comment on lines +301 to +303
if download_status == DownloadStatus.CORRUPTED:
LOGGER.error(f"Tile {tile.dir}/{tile.name} was corrupted, removing it...")
filepath.unlink()
Copy link
Member Author

Choose a reason for hiding this comment

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

if it was corrupted in the end, let's remove that tile from the file system

kevinkreiser
kevinkreiser previously approved these changes Dec 18, 2023
Copy link
Member

@kevinkreiser kevinkreiser left a comment

Choose a reason for hiding this comment

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

maybe use 4 or something instead of 15 tries

@nilsnolde
Copy link
Member Author

changed it to 5 retries, totalling 7.5 mins in worst case.

@nilsnolde
Copy link
Member Author

not gonna merge master again with the admin changes

@nilsnolde nilsnolde merged commit 52d6ca7 into master Dec 18, 2023
8 of 9 checks passed
@nilsnolde nilsnolde deleted the nn-elevation-download branch December 18, 2023 20:53
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.

valhalla_build_elevation is not robust to corrupt downloads
2 participants