Skip to content

Commit 07658f4

Browse files
committed
Port quickfix from exploratory branch
1 parent 895f5ea commit 07658f4

File tree

15 files changed

+320
-258
lines changed

15 files changed

+320
-258
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ repos:
4545
- id: no-commit-to-branch
4646
args: [--branch, dev, --branch, int, --branch, main]
4747
- repo: https://github.com/astral-sh/ruff-pre-commit
48-
rev: v0.9.9
48+
rev: v0.11.0
4949
hooks:
5050
- id: ruff
5151
args: [--fix, --exit-non-zero-on-fix]

.pyproject_generation/pyproject_custom.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ghga_connector"
3-
version = "1.7.0"
3+
version = "1.7.1"
44
description = "GHGA Connector - A CLI client application for interacting with the GHGA system."
55
dependencies = [
66
"typer~=0.15",

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ We recommend using the provided Docker container.
2626

2727
A pre-build version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/ghga-connector):
2828
```bash
29-
docker pull ghga/ghga-connector:1.7.0
29+
docker pull ghga/ghga-connector:1.7.1
3030
```
3131

3232
Or you can build the container yourself from the [`./Dockerfile`](./Dockerfile):
3333
```bash
3434
# Execute in the repo's root dir:
35-
docker build -t ghga/ghga-connector:1.7.0 .
35+
docker build -t ghga/ghga-connector:1.7.1 .
3636
```
3737

3838
For production-ready deployment, we recommend using Kubernetes, however,
3939
for simple use cases, you could execute the service using docker
4040
on a single server:
4141
```bash
4242
# The entrypoint is preconfigured:
43-
docker run -p 8080:8080 ghga/ghga-connector:1.7.0 --help
43+
docker run -p 8080:8080 ghga/ghga-connector:1.7.1 --help
4444
```
4545

4646
If you prefer not to use containers, you may install the service from source:

lock/requirements-dev.txt

Lines changed: 202 additions & 201 deletions
Large diffs are not rendered by default.

lock/requirements.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ annotated-types==0.7.0 \
44
# via
55
# -c lock/requirements-dev.txt
66
# pydantic
7-
anyio==4.8.0 \
8-
--hash=sha256:1d9fe889df5212298c0c0723fa20479d1b94883a2df44bd3897aa91083316f7a \
9-
--hash=sha256:b5011f270ab5eb0abf13385f851315585cc37ef330dd88e27ec3d34d651fd47a
7+
anyio==4.9.0 \
8+
--hash=sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028 \
9+
--hash=sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c
1010
# via
1111
# -c lock/requirements-dev.txt
1212
# httpx
@@ -65,14 +65,15 @@ bcrypt==4.3.0 \
6565
# via
6666
# -c lock/requirements-dev.txt
6767
# crypt4gh
68-
boto3==1.37.6 \
69-
--hash=sha256:4c661389e68437a3fbc1f63decea24b88f7175e022c68622848d47fdf6e0144f
68+
boto3==1.37.14 \
69+
--hash=sha256:56b4d1e084dbca43d5fdd070f633a84de61a6ce592655b4d239d263d1a0097fc \
70+
--hash=sha256:cf2e5e6d56efd5850db8ce3d9094132e4759cf2d4b5fd8200d69456bf61a20f3
7071
# via
7172
# -c lock/requirements-dev.txt
7273
# hexkit
73-
botocore==1.37.6 \
74-
--hash=sha256:2cb121a403cbec047d76e2401a402a6b2efd3309169037fbac588e8f7125aec4 \
75-
--hash=sha256:cd282fe9c8adbb55a08c7290982a98ac6cc4507fa1c493f48bc43fd6c8376a57
74+
botocore==1.37.14 \
75+
--hash=sha256:709a1796f436f8e378e52170e58501c1f3b5f2d1308238cf1d6a3bdba2e32851 \
76+
--hash=sha256:b0adce3f0fb42b914eb05079f50cf368cb9cf9745fdd206bd91fe6ac67b29aca
7677
# via
7778
# -c lock/requirements-dev.txt
7879
# boto3
@@ -220,9 +221,9 @@ exceptiongroup==1.2.2 \
220221
# via
221222
# -c lock/requirements-dev.txt
222223
# anyio
223-
ghga-service-commons==3.4.0 \
224-
--hash=sha256:4301e60d5aff771bee6d9851a5cd5989ddef9bceab95bda108dd20a21d64c469 \
225-
--hash=sha256:f525693b66fad3e779d8c873252f21fedf480a255ebc557ce6bbeba09e718d14
224+
ghga-service-commons==3.4.1 \
225+
--hash=sha256:2ced19b2b0e07d7471b68a73eacb3272473eae74b7e74b7b101b0c90ea4a0170 \
226+
--hash=sha256:37d9cf122e776a70fd15d3dfa355dd386d5b3426514a3b3245207875fcbce9eb
226227
# via
227228
# -c lock/requirements-dev.txt
228229
# ghga-connector (pyproject.toml)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ classifiers = [
2121
"Intended Audience :: Developers",
2222
]
2323
name = "ghga_connector"
24-
version = "1.7.0"
24+
version = "1.7.1"
2525
description = "GHGA Connector - A CLI client application for interacting with the GHGA system."
2626
dependencies = [
2727
"typer~=0.15",

src/ghga_connector/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""CLI-specific wrappers around core functions."""
1717

1818
import asyncio
19+
import logging
1920
import os
2021
import sys
2122
from dataclasses import dataclass
@@ -301,6 +302,10 @@ async def async_download( # noqa: PLR0913
301302
overwrite: bool = False,
302303
):
303304
"""Download files asynchronously"""
305+
# enable debug logging
306+
if debug:
307+
logging.basicConfig(level=logging.DEBUG)
308+
304309
if not my_public_key_path.is_file():
305310
raise exceptions.PubKeyFileDoesNotExistError(public_key_path=my_public_key_path)
306311

src/ghga_connector/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
It should not contain any service API-related code.
1919
"""
2020

21-
from .client import async_client, httpx_client, retry_handler # noqa: F401
21+
from .client import RetryHandler, async_client # noqa: F401
2222
from .file_operations import ( # noqa: F401
2323
calc_part_ranges,
2424
get_segments,

src/ghga_connector/core/client.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
# limitations under the License.
1515
"""Handling session initialization for httpx"""
1616

17-
from contextlib import asynccontextmanager, contextmanager
18-
from functools import cached_property
17+
from contextlib import asynccontextmanager
1918
from typing import Union
2019

2120
import hishel
@@ -33,11 +32,11 @@
3332
from ghga_connector.constants import TIMEOUT
3433

3534

36-
class HttpxClientConfigurator:
35+
class RetryHandler:
3736
"""Helper class to make max_retries user configurable"""
3837

39-
@cached_property
40-
def retry_handler(self):
38+
@classmethod
39+
def basic(cls):
4140
"""Configure client retry handler with exponential backoff"""
4241
return AsyncRetrying(
4342
reraise=True,
@@ -58,22 +57,6 @@ def retry_handler(self):
5857
)
5958

6059

61-
retry_handler = HttpxClientConfigurator().retry_handler
62-
63-
64-
@contextmanager
65-
def httpx_client():
66-
"""Yields a context manager httpx client and closes it afterward"""
67-
with httpx.Client(
68-
timeout=TIMEOUT,
69-
limits=httpx.Limits(
70-
max_connections=CONFIG.max_concurrent_downloads,
71-
max_keepalive_connections=CONFIG.max_concurrent_downloads,
72-
),
73-
) as client:
74-
yield client
75-
76-
7760
def get_cache_transport(
7861
wrapped_transport: Union[httpx.AsyncBaseTransport, None] = None,
7962
) -> hishel.AsyncCacheTransport:
@@ -84,7 +67,8 @@ def get_cache_transport(
8467
"""
8568
cache_transport = hishel.AsyncCacheTransport(
8669
transport=wrapped_transport or httpx.AsyncHTTPTransport(),
87-
storage=hishel.AsyncInMemoryStorage(ttl=1800), # persist for 30 minutes
70+
# set ttl to expected lifetime of presigned URL - min-fresh
71+
storage=hishel.AsyncInMemoryStorage(ttl=57, capacity=512),
8872
controller=hishel.Controller(
8973
cacheable_methods=["POST", "GET"],
9074
cacheable_status_codes=[200, 201],

src/ghga_connector/core/downloading/abstract_downloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def download_file(self, *, output_path: Path, part_size: int):
3535
"""Download file to the specified location and manage lower level details."""
3636

3737
@abstractmethod
38-
def fetch_download_url(self) -> Coroutine[URLResponse, Any, Any]:
38+
def fetch_download_url(self, bust_cache: bool) -> Coroutine[URLResponse, Any, Any]:
3939
"""Wait until download URL can be generated.
4040
Returns a URLResponse containing two elements:
4141
1. the download url

0 commit comments

Comments
 (0)