Skip to content

fix(user_tools): honor AWS profile S3 endpoints - #2106

Open
WilliamK112 wants to merge 3 commits into
NVIDIA:devfrom
WilliamK112:codex/support-aws-profile-s3-endpoint
Open

WilliamK112 wants to merge 3 commits into
NVIDIA:devfrom
WilliamK112:codex/support-aws-profile-s3-endpoint

Conversation

@WilliamK112

@WilliamK112 WilliamK112 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Add a shared S3 endpoint resolver used by both the Python S3Fs handler and local Hadoop job argument construction. Existing explicit and environment behavior is preserved, with AWS profile configuration consulted only when no endpoint environment variable is set.

Endpoint precedence is:

  1. explicit endpoint_override argument for S3Fs
  2. AWS_ENDPOINT_URL_S3
  3. AWS_ENDPOINT_URL
  4. the active AWS profile from AWS_CONFIG_FILE or ~/.aws/config

Profile selection follows AWS_PROFILE, then AWS_DEFAULT_PROFILE, then default, and resolves exactly one active profile. If an explicitly selected profile has no endpoint, the resolver returns no override instead of falling through to another profile whose credentials are not active.

The selected profile supports profile-level endpoint_url, service-section S3 endpoints, and nested S3 endpoint configuration. Missing, malformed, or undecodable config files are ignored. AWS config is read as UTF-8 with interpolation disabled so percent-encoded endpoint URLs remain intact.

For local Java jobs, a resolved custom endpoint is also passed as the Hadoop S3A endpoint with path-style access enabled.

Fixes #2087.

Validation

Merged current dev (2073060) into the PR branch, then ran from user_tools:

  • PYTHONPATH=src .venv/bin/python -m pytest tests/spark_rapids_tools_ut/test_csppath.py -q — 21 passed
  • PYTHONPATH=src .venv/bin/python -m pytest tests/spark_rapids_tools_ut/test_csppath.py tests/spark_rapids_tools_ut/test_cluster.py -q — 28 passed
  • Pylint on the parser and regression tests — 10.00/10
  • Flake8 on the parser and regression tests
  • py_compile on the parser
  • git diff --check upstream/dev...HEAD

@github-actions github-actions Bot added the user_tools Scope the wrapper module running CSP, QualX, and reports (python) label Jun 23, 2026
@WilliamK112
WilliamK112 marked this pull request as ready for review August 22, 2026 19:01
@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable new defects or outstanding previous findings remain.

Summary

  • Adds profile, services-section, and nested S3 endpoint resolution.
  • Selects exactly one active profile without borrowing endpoints from fallback profiles.
  • Safely ignores missing, malformed, and undecodable configuration while preserving percent-encoded URLs.
  • Applies resolved endpoints to both S3Fs and Hadoop S3A configuration.
  • Adds regression coverage for precedence, parsing, profile selection, and explicit overrides.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Resolve S3 endpoint] --> B{AWS_ENDPOINT_URL_S3 set?}
    B -->|Yes| C[Use S3 environment endpoint]
    B -->|No| D{AWS_ENDPOINT_URL set?}
    D -->|Yes| E[Use global environment endpoint]
    D -->|No| F[Select one active AWS profile]
    F --> G[Read AWS config without interpolation]
    G --> H{S3 endpoint configured?}
    H -->|Services or nested S3| I[Use service-specific endpoint]
    H -->|Profile-level only| J[Use profile endpoint]
    H -->|No| K[No endpoint override]
    C --> L[Python S3Fs and Hadoop S3A]
    E --> L
    I --> L
    J --> L
Loading

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'upstream/d..."

Comment thread user_tools/src/spark_rapids_tools/storagelib/s3/aws_config.py Outdated
Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
@WilliamK112
WilliamK112 force-pushed the codex/support-aws-profile-s3-endpoint branch from 210a278 to b9c37d4 Compare September 9, 2026 16:52
Comment thread user_tools/src/spark_rapids_tools/storagelib/s3/aws_config.py Outdated
Signed-off-by: Ching-Wei Kang <ckang53@wisc.edu>
…ofile-s3-endpoint

Signed-off-by: Ching-Wei Kang <ckang53@wisc.edu>
@WilliamK112

Copy link
Copy Markdown
Contributor Author

I addressed the latest parser finding in 9eee17b, then merged current dev into the branch as requested for active PR updates (no rebase or force-push).

Fresh validation after the merge passes: 21 endpoint/path tests, 28 combined endpoint and cluster tests, Pylint 10.00/10, Flake8, py_compile, and git diff --check.

Could you please take another look when convenient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

user_tools Scope the wrapper module running CSP, QualX, and reports (python)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support AWS profile endpoint_url for S3-compatible object stores

2 participants