Skip to content

Commit

Permalink
fix(client): disable bucket cache if region or endpoint are specified (
Browse files Browse the repository at this point in the history
  • Loading branch information
shcheklein authored Jan 12, 2025
1 parent 2364ac2 commit b3a060d
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit b3a060d

Please sign in to comment.