fix: default TEMPDIR to system temp so S3 works with read-only CWD - #3372
Open
Shriprasad-P wants to merge 3 commits into
Open
Shriprasad-P wants to merge 3 commits into
Shriprasad-P wants to merge 3 commits into
Conversation
Contributor
Greptile SummaryThis PR changes the default Metaflow temporary directory from the current working directory to Python’s system temporary directory, allowing S3 initialization from a read-only working directory.
Confidence Score: 5/5The PR appears safe to merge; no actionable new issue or outstanding previous finding remains. The current implementation preserves configured overrides, uses the system temporary directory by default, and isolates import-time configuration checks in subprocesses. The earlier state-leak finding was manually resolved without an explanatory reply, and the current subprocess implementation removes the shared module-reload behavior that caused it.
|
| Filename | Overview |
|---|---|
| metaflow/metaflow_config.py | Defaults TEMPDIR to tempfile.gettempdir() while preserving configuration overrides. |
| metaflow/plugins/datatools/s3/s3.py | Updates the S3 API documentation to accurately describe temporary-directory precedence. |
| metaflow/plugins/aws/batch/batch_decorator.py | Updates the Batch runtime comment to reflect the system temporary-directory default. |
| metaflow/plugins/kubernetes/kubernetes_decorator.py | Updates the Kubernetes runtime comment to reflect the system temporary-directory default. |
| test/unit/test_s3_readonly_cwd.py | Adds subprocess-isolated coverage for read-only working directories and explicit temp-directory overrides. |
Reviews (4): Last reviewed commit: "Isolate S3 tempdir tests in subprocesses" | Re-trigger Greptile
Shriprasad-P
force-pushed
the
cursor/fix-s3-cwd-writeable-854-b94d
branch
from
September 12, 2026 19:28
88d4d64 to
6c18caf
Compare
The S3 client was using the current working directory (CWD) as the default location for temporary files. This caused issues when the CWD was read-only or not writable. Changed TEMPDIR default from '.' to tempfile.gettempdir() which uses the system's temporary directory (typically /tmp on Unix systems). Added test to verify S3 client works correctly in read-only directories. Fixes Netflix#854
Shriprasad-P
force-pushed
the
cursor/fix-s3-cwd-writeable-854-b94d
branch
from
September 14, 2026 03:11
6c18caf to
e5fd50e
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fixes #854
Summary
Default
TEMPDIRtotempfile.gettempdir()instead of., so the S3 client no longer requires the current working directory to be writable.Test plan