mrutunjay-kinagi commented on code in PR #3063:
URL: https://github.com/apache/iceberg-python/pull/3063#discussion_r2821515331
##########
pyiceberg/catalog/rest/__init__.py:
##########
@@ -680,11 +684,25 @@ 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(
region_name=get_first_property_value(self._properties,
AWS_REGION),
Review Comment:
Good call, agreed. I have aligned this with Glue by passing
`client.profile-name` into the SigV4 `boto3.Session` initialization. I also
added a regression test (`test_sigv4_uses_client_profile_name`) to lock this
behavior. This is now pushed on this PR branch.
--
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]