Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions skore-hub-project/src/skore_hub_project/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Package that provides APIs to communicate between ``skore`` and ``skore hub``."""

import logging
from base64 import b64decode, b64encode
from contextlib import contextmanager

Expand All @@ -18,6 +19,9 @@
]


logging.basicConfig()
logger = logging.getLogger(__name__)

console = Console(
width=88,
theme=Theme(
Expand Down
12 changes: 11 additions & 1 deletion skore-hub-project/src/skore_hub_project/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import logging
from contextlib import suppress
from http import HTTPStatus
from os import environ
Expand All @@ -26,6 +27,8 @@

from ..authentication import token as Token

logger = logging.getLogger(__name__)


class Client(HTTPXClient):
"""
Expand Down Expand Up @@ -106,7 +109,14 @@ def request(self, *args, **kwargs) -> Response:
timeout = self.retry_backoff_factor * (2**retries)
retries += 1

sleep(min(timeout, self.retry_backoff_max))
sleep_duration = min(timeout, self.retry_backoff_max)

logger.warn(
"Request failed to reach server. "
f"Trying again in {sleep_duration} seconds."
)

sleep(sleep_duration)

# Raise extended exception with body message when available.
status_class = response.status_code // 100
Expand Down
Loading