Skip to content

Commit 3d53f42

Browse files
committed
add request timeout config
1 parent 2cd4e78 commit 3d53f42

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

mkdocs/docs/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ For the FileIO there are several configuration options available:
116116
| s3.region | us-west-2 | Configure the default region used to initialize an `S3FileSystem`. `PyArrowFileIO` attempts to automatically resolve the region for each S3 bucket, falling back to this value if resolution fails. |
117117
| s3.proxy-uri | <http://my.proxy.com:8080> | Configure the proxy server to be used by the FileIO. |
118118
| s3.connect-timeout | 60.0 | Configure socket connection timeout, in seconds. |
119+
| s3.request-timeout | 60.0 | Configure socket read timeouts on Windows and macOS, in seconds. |
119120
| s3.force-virtual-addressing | False | Whether to use virtual addressing of buckets. If true, then virtual addressing is always enabled. If false, then virtual addressing is only enabled if endpoint_override is empty. This can be used for non-AWS backends that only support virtual hosted-style access. |
120121

121122
<!-- markdown-link-check-enable-->

pyiceberg/io/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
S3_REGION = "s3.region"
6262
S3_PROXY_URI = "s3.proxy-uri"
6363
S3_CONNECT_TIMEOUT = "s3.connect-timeout"
64+
S3_REQUEST_TIMEOUT = "s3.request-timeout"
6465
S3_SIGNER_URI = "s3.signer.uri"
6566
S3_SIGNER_ENDPOINT = "s3.signer.endpoint"
6667
S3_SIGNER_ENDPOINT_DEFAULT = "v1/aws/s3/sign"

pyiceberg/io/fsspec.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
S3_ENDPOINT,
6666
S3_PROXY_URI,
6767
S3_REGION,
68+
S3_REQUEST_TIMEOUT,
6869
S3_SECRET_ACCESS_KEY,
6970
S3_SESSION_TOKEN,
7071
S3_SIGNER_ENDPOINT,
@@ -150,6 +151,9 @@ def _s3(properties: Properties) -> AbstractFileSystem:
150151
if connect_timeout := properties.get(S3_CONNECT_TIMEOUT):
151152
config_kwargs["connect_timeout"] = float(connect_timeout)
152153

154+
if request_timeout := properties.get(S3_REQUEST_TIMEOUT):
155+
config_kwargs["read_timeout"] = float(request_timeout)
156+
153157
fs = S3FileSystem(client_kwargs=client_kwargs, config_kwargs=config_kwargs)
154158

155159
for event_name, event_function in register_events.items():

pyiceberg/io/pyarrow.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
S3_FORCE_VIRTUAL_ADDRESSING,
105105
S3_PROXY_URI,
106106
S3_REGION,
107+
S3_REQUEST_TIMEOUT,
107108
S3_ROLE_ARN,
108109
S3_ROLE_SESSION_NAME,
109110
S3_SECRET_ACCESS_KEY,
@@ -394,6 +395,9 @@ def _initialize_oss_fs(self) -> FileSystem:
394395
if connect_timeout := self.properties.get(S3_CONNECT_TIMEOUT):
395396
client_kwargs["connect_timeout"] = float(connect_timeout)
396397

398+
if request_timeout := self.properties.get(S3_REQUEST_TIMEOUT):
399+
client_kwargs["request_timeout"] = float(request_timeout)
400+
397401
if role_arn := get_first_property_value(self.properties, S3_ROLE_ARN, AWS_ROLE_ARN):
398402
client_kwargs["role_arn"] = role_arn
399403

@@ -438,6 +442,9 @@ def _initialize_s3_fs(self, netloc: Optional[str]) -> FileSystem:
438442
if connect_timeout := self.properties.get(S3_CONNECT_TIMEOUT):
439443
client_kwargs["connect_timeout"] = float(connect_timeout)
440444

445+
if request_timeout := self.properties.get(S3_REQUEST_TIMEOUT):
446+
client_kwargs["request_timeout"] = float(request_timeout)
447+
441448
if role_arn := get_first_property_value(self.properties, S3_ROLE_ARN, AWS_ROLE_ARN):
442449
client_kwargs["role_arn"] = role_arn
443450

0 commit comments

Comments
 (0)