fix(#592): forward S3/storage env vars to remote MPI ranks via -x#596
Merged
Conversation
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
OpenMPI does not propagate arbitrary env vars to remote hosts by
default; -x VARNAME opts a specific variable in. Before this fix,
only DLIO_DROP_CACHES_TIMEOUT was forwarded. For multi-host
object-storage runs, remote ranks had no AWS_*, S3DLIO_*,
STORAGE_LIBRARY, or BUCKET — the first S3 operation on each remote
rank would hang or fail with an authentication error.
Fix: in generate_dlio_command(), after the existing
DLIO_DROP_CACHES_TIMEOUT forwarding, iterate os.environ (sorted)
and append "-x VARNAME" for every var whose name starts with AWS_
or S3DLIO_, or is exactly STORAGE_LIBRARY or BUCKET.
Tests (tests/unit/test_mpi_s3_env_forwarding.py — 11 new tests):
TestS3EnvForwardingMissing (6 tests): each asserts a required
-x flag IS present in generate_dlio_command() output, calling
the real method with generate_mpi_prefix_cmd patched to a fixed
string. All 6 FAILED before this fix (bug confirmed), all 6
PASS after:
- test_aws_endpoint_url_forwarded
- test_aws_access_key_id_forwarded
- test_aws_secret_access_key_forwarded
- test_s3dlio_follow_redirects_forwarded
- test_storage_library_forwarded
- test_bucket_forwarded
TestAbsentVarsNotForwarded (2 tests): vars not in the launcher
env must not appear as -x flags (no spurious forwarding).
TestDropCachesTimeoutStillForwarded (2 tests): pre-existing
DLIO_DROP_CACHES_TIMEOUT forwarding must not regress; also
verifies both DLIO and S3 vars appear together when all are set.
TestNonMpiRunsUnchanged (1 test): no -x flags when exec_type
is not MPI.
Full suite: 2266 passed, no regressions.
e2dc931 to
69ae4b2
Compare
FileSystemGuy
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #592 (Problem A — S3 credential forwarding).
The bug
OpenMPI does not propagate arbitrary env vars to remote hosts by
default. For a multi-host object-storage run, the launcher host sets
AWS_ENDPOINT_URL,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,S3DLIO_FOLLOW_REDIRECTS,STORAGE_LIBRARY, andBUCKET— but onlyDLIO_DROP_CACHES_TIMEOUTwas being forwarded to remote ranks via-x. Remote ranks had none of the S3 config and would hang or failwith auth errors on their first S3 operation.
The fix
In
DLIOBenchmark.generate_dlio_command(), after the existingDLIO_DROP_CACHES_TIMEOUTforwarding, iterateos.environ(sortedfor determinism) and append
-x VARNAMEfor every variable whose namestarts with
AWS_orS3DLIO_, or is exactlySTORAGE_LIBRARYorBUCKET.Tests
11 new tests in
tests/unit/test_mpi_s3_env_forwarding.py. All callthe real
generate_dlio_command()withgenerate_mpi_prefix_cmdpatched to a fixed prefix string.
TestS3EnvForwardingMissing(6 tests) — RED before fix, GREEN after:test_aws_endpoint_url_forwarded— S3 endpoint must reach remote rankstest_aws_access_key_id_forwarded— access key must reach remote rankstest_aws_secret_access_key_forwarded— secret key must reach remote rankstest_s3dlio_follow_redirects_forwarded— AIStore redirect flag must reach remote rankstest_storage_library_forwarded— storage library selection must reach remote rankstest_bucket_forwarded— bucket name must reach remote ranksTestAbsentVarsNotForwarded(2 tests):-xflagsTestDropCachesTimeoutStillForwarded(2 tests):-x DLIO_DROP_CACHES_TIMEOUTforwarding must not regressTestNonMpiRunsUnchanged(1 test):-xflags whenexec_typeis not MPIVerification
uv run pytest tests/unit/test_mpi_s3_env_forwarding.py -v→7 FAILED (bug confirmed), then 11 passed after fix
uv run pytest tests/unit -q→ 2266 passed, no regressionshang/auth-fail on remote ranks
Files
mlpstorage_py/benchmarks/dlio.py— extend MPI env forwarding looptests/unit/test_mpi_s3_env_forwarding.py— 11 new tests