Fokko commented on code in PR #3063:
URL: https://github.com/apache/iceberg-python/pull/3063#discussion_r2825843542
##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -680,12 +692,27 @@ def _init_sigv4(self, session: Session) -> None:
from botocore.awsrequest import AWSRequest
from requests import PreparedRequest
from requests.adapters import HTTPAdapter
+ from urllib3.util.retry import Retry
class SigV4Adapter(HTTPAdapter):
def __init__(self, **properties: str):
- super().__init__()
self._properties = properties
+ max_retries = property_as_int(self._properties,
SIGV4_MAX_RETRIES, SIGV4_DEFAULT_MAX_RETRIES)
+ super().__init__(
+ max_retries=Retry(
+ total=max_retries,
+ status=max_retries,
+ connect=max_retries,
+ read=max_retries,
+ # Keep retries conservative for idempotent calls.
+ allowed_methods=frozenset({"GET", "HEAD", "OPTIONS"}),
+ status_forcelist=SIGV4_RETRY_STATUS_CODES,
+ backoff_factor=SIGV4_RETRY_BACKOFF_FACTOR,
+ respect_retry_after_header=True,
+ )
+ )
self._boto_session = boto3.Session(
+ profile_name=get_first_property_value(self._properties,
AWS_PROFILE_NAME),
Review Comment:
This is an unrelated change, but I think it makes sense to pass in the
profile here as well
##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -680,12 +692,27 @@ def _init_sigv4(self, session: Session) -> None:
from botocore.awsrequest import AWSRequest
from requests import PreparedRequest
from requests.adapters import HTTPAdapter
+ from urllib3.util.retry import Retry
class SigV4Adapter(HTTPAdapter):
def __init__(self, **properties: str):
- super().__init__()
self._properties = properties
+ max_retries = property_as_int(self._properties,
SIGV4_MAX_RETRIES, SIGV4_DEFAULT_MAX_RETRIES)
+ super().__init__(
+ max_retries=Retry(
+ total=max_retries,
+ status=max_retries,
+ connect=max_retries,
+ read=max_retries,
+ # Keep retries conservative for idempotent calls.
+ allowed_methods=frozenset({"GET", "HEAD", "OPTIONS"}),
Review Comment:
Not sure if this is relevant since we only do `GET` requests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]