Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): disable bucket cache if region or endpoint are specified #809

Merged
merged 1 commit into from
Jan 12, 2025
Merged
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
9 changes: 6 additions & 3 deletions src/datachain/client/s3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import os
from typing import Any, Optional, cast
from urllib.parse import parse_qs, urlsplit, urlunsplit

Expand Down Expand Up @@ -31,9 +32,11 @@ def create_fs(cls, **kwargs) -> S3FileSystem:
if "aws_token" in kwargs:
kwargs.setdefault("token", kwargs.pop("aws_token"))

# caching bucket regions to use the right one in signed urls, otherwise
# it tries to randomly guess and creates wrong signature
kwargs.setdefault("cache_regions", True)
# remove this `if` when https://github.com/fsspec/s3fs/pull/929 lands
if not os.environ.get("AWS_REGION") and not os.environ.get("AWS_ENDPOINT_URL"):
# caching bucket regions to use the right one in signed urls, otherwise
# it tries to randomly guess and creates wrong signature
kwargs.setdefault("cache_regions", True)

# We want to use newer v4 signature version since regions added after
# 2014 are not going to support v2 which is the older one.
Expand Down
Loading