Skip to content
Draft
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
14 changes: 14 additions & 0 deletions metaflow/plugins/aws/aws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def get_client(
"Could not import module 'boto3'. Install boto3 first."
)

from metaflow.version import metaflow_version

# Convert dictionary config to Config object if needed
if "config" in client_params and not isinstance(
client_params["config"], Config
Expand All @@ -49,6 +51,18 @@ def get_client(
config.retries = S3_CLIENT_RETRY_CONFIG
client_params["config"] = config

if module == "s3":
# Identify Metaflow to any S3-compatible endpoint, appending to (not
# replacing) any user agent the caller already configured.
config = client_params.get("config", Config())
ua = "metaflow/%s" % metaflow_version
existing_ua = config.user_agent_extra
if not existing_ua:
config.user_agent_extra = ua
elif ua not in existing_ua.split():
config.user_agent_extra = "%s %s" % (existing_ua, ua)
client_params["config"] = config

if AWS_SANDBOX_ENABLED:
# role is ignored in the sandbox
global cached_aws_sandbox_creds
Expand Down