-
Notifications
You must be signed in to change notification settings - Fork 92
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
New take on retrying order asset downloads #1011
base: maint-2.1
Are you sure you want to change the base?
Conversation
Wraps the entire orders.download_asset() in a retry, eliminating the double download and concentrating the retry complexity instead of spreading it over several modules. Resolves #1010
# Size from boto3.s3.transfer.TransferConfig | ||
# io_chunksize. Planet assets are generally | ||
# several MB or more. | ||
async for chunk in resp.aiter_bytes(chunk_size=262144): |
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.
Default chunk size was 100 before... made the progress bar look smooth, but bad for overall throughput.
@@ -587,9 +587,7 @@ async def _stream_img(): | |||
# an error caused by respx and not this code | |||
# https://github.com/lundberg/respx/issues/130 | |||
respx.get(dl_url).side_effect = [ | |||
httpx.Response(HTTPStatus.OK, | |||
headers=img_headers, | |||
request='donotcloneme'), |
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.
Behavior of this PR no longer depends on multiple download requests.
if not filename: | ||
raise exceptions.ClientError( | ||
f'Could not determine filename at {location}') | ||
async with self._session._limiter, self._session._client.stream('GET', location) as resp: |
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.
Rate limiter is used here.
Wraps the entire orders.download_asset() in a retry, eliminating the double download and concentrating the retry complexity instead of spreading it over several modules.
Resolves #1010