|
tries_left = MAX_RETRIES_PER_RANGE |
|
while tries_left > 0: |
|
try: |
|
range_headers = {"Range": f"bytes={from_byte_index}-{to_byte_index}"} |
|
with self.job.connection.get(path=url, headers=range_headers, stream=True) as r: |
|
r.raise_for_status() |
|
for block in r.iter_content(chunk_size=chunk_size): |
|
f.write(block) |
|
break |
|
except OpenEoApiPlainError as error: |
|
tries_left -= 1 |
|
if tries_left > 0 and error.http_status_code in RETRIABLE_STATUSCODES: |
|
logger.warning( |
|
f"Failed to retrieve chunk {from_byte_index}-{to_byte_index} from {url} (status {error.http_status_code}) - retrying" |
|
) |
as suggested in #933 (comment), replace this DIY retry logic with standard retry utilities like urllib3.util.Retry.
Actually, RestApiConnection already has such a retry config by default since #770 (for #441 and #764)
so the DIY retry logic can probably just be dropped
openeo-python-client/openeo/rest/job.py
Lines 557 to 571 in 88d793b
as suggested in #933 (comment), replace this DIY retry logic with standard retry utilities like
urllib3.util.Retry.Actually,
RestApiConnectionalready has such a retry config by default since #770 (for #441 and #764)so the DIY retry logic can probably just be dropped