Skip to content

Commit

Permalink
Release 1.7.14, Merge pull request #362 from sentinel-hub/develop
Browse files Browse the repository at this point in the history
Release 1.7.14
  • Loading branch information
zigaLuksic authored Nov 8, 2024
2 parents 9fadfcd + bb972b3 commit 28aa4cc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [Version 1.7.14] - 2024-11-08

- Improve batch download retries in case of partial downloads.


## [Version 1.7.13] - 2024-11-06

- Improve batch download retrying in case of temporary 404 errors
Expand Down
2 changes: 1 addition & 1 deletion eogrow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""The main module of the eo-grow package."""

__version__ = "1.7.13"
__version__ = "1.7.14"
12 changes: 12 additions & 0 deletions eogrow/pipelines/download_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def run_procedure(self) -> tuple[list[str], list[str]]:
break
LOGGER.info("Retrying due to PARTIAL status.")
self.batch_client.restart_job(batch_request)
batch_request = self._wait_for_partial_status_update(batch_request)
results = self._monitor_job(batch_request)

processed = self._get_tile_names_from_results(results, BatchTileStatus.PROCESSED)
Expand All @@ -214,6 +215,17 @@ def run_procedure(self) -> tuple[list[str], list[str]]:
LOGGER.info(log_msg)
return processed, failed

def _wait_for_partial_status_update(self, batch_request: BatchRequest) -> BatchRequest:
"""Wait for the batch job to update the status to PARTIAL with an exponential backoff."""
wait_time, max_wait_time = 1, 5 * 60
while wait_time < max_wait_time:
time.sleep(wait_time)
wait_time *= 2
if self.batch_client.get_request(batch_request).status != BatchRequestStatus.PARTIAL:
break

return self.batch_client.get_request(batch_request)

def _create_or_collect_batch_request(self) -> BatchRequest:
"""Either creates a new batch request or collects information about an existing one."""
if not self.config.batch_id:
Expand Down

0 comments on commit 28aa4cc

Please sign in to comment.