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

Tenacity based retry logic and fully async download #103

Merged
merged 17 commits into from
Sep 12, 2024

Conversation

mephenor
Copy link
Member

@mephenor mephenor commented Sep 5, 2024

This PR changes the following existing functionality:

  • AsyncClient is now used during download where possible instead of the synchronous httpx client for download - upload path has only been adjusted where needed for consistency
  • WorkpackageAccesor and Downloader now use a retry handler for some calls. Fetching download URLs and authorization is not included, but could be added in the future by making the retry handler more generic
  • The multithreaded pool executor filling the download queue and associated logic has been replaced by equivalent async functionality using tasks and semaphores to ensure only a specified amount of downloads runs in parallel and the queue is only filled up to the specified amount. This removes explicit waits and should make this part of the code less finicky.
  • New client config options (retry_status_codes, exponential_backoff_max) have been introduced and the maximum number of concurrent part downloads to run is now also exposed as config option
  • Bump to 1.5.0

Had to change some core imports to directly import from the appropiate module due to circular dependencies... As this seems to happen again and again, I created I task to investigate that in the future.
Also might need to update some files from template, as there are some ignores in there due to targeting Python 3.9 compatibility.

@mephenor mephenor changed the title Tenacity base retry logic and fully async download Tenacity based retry logic and fully async download Sep 5, 2024
@coveralls
Copy link

coveralls commented Sep 5, 2024

Pull Request Test Coverage Report for Build 10810140574

Details

  • 225 of 254 (88.58%) changed or added relevant lines in 15 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.8%) to 72.779%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ghga_connector/core/client.py 7 9 77.78%
src/ghga_connector/core/api_calls/work_package.py 28 31 90.32%
src/ghga_connector/cli.py 26 30 86.67%
src/ghga_connector/core/downloading/downloader.py 85 94 90.43%
src/ghga_connector/core/main.py 15 26 57.69%
Files with Coverage Reduction New Missed Lines %
src/ghga_connector/core/api_calls/well_knowns.py 1 90.91%
src/ghga_connector/core/client.py 1 84.21%
Totals Coverage Status
Change from base Build 10161219570: 0.8%
Covered Lines: 1024
Relevant Lines: 1407

💛 - Coveralls

@mephenor mephenor marked this pull request as ready for review September 5, 2024 14:05
Copy link
Member

@TheByronHimes TheByronHimes left a comment

Choose a reason for hiding this comment

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

There are a few things that can be improved, nothing very big though.

src/ghga_connector/core/client.py Show resolved Hide resolved
src/ghga_connector/config.py Show resolved Hide resolved
src/ghga_connector/core/downloading/downloader.py Outdated Show resolved Hide resolved
src/ghga_connector/config.py Show resolved Hide resolved
src/ghga_connector/config.py Outdated Show resolved Hide resolved
src/ghga_connector/core/downloading/abstract_downloader.py Outdated Show resolved Hide resolved
src/ghga_connector/core/downloading/abstract_downloader.py Outdated Show resolved Hide resolved
tests/integration/test_cli.py Outdated Show resolved Hide resolved
TheByronHimes
TheByronHimes previously approved these changes Sep 11, 2024
@mephenor mephenor merged commit 6526fbe into main Sep 12, 2024
11 checks passed
@mephenor mephenor deleted the fix/download_retry_logic branch September 17, 2024 08:24
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.

3 participants