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

New take on retrying order asset downloads #1011

Draft
wants to merge 1 commit into
base: maint-2.1
Choose a base branch
from
Draft

Conversation

sgillies
Copy link
Contributor

@sgillies sgillies commented Aug 1, 2023

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

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):
Copy link
Contributor Author

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'),
Copy link
Contributor Author

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:
Copy link
Contributor Author

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.

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.

1 participant