Skip to content

Conversation

yxtay
Copy link
Contributor

@yxtay yxtay commented Mar 14, 2025

What does this PR do?

Removes arguments passed to TemporaryDirectory that assumes that cwd is writable.
This means that tmp_dir will probably be create in /tmp, which should work for all use cases.

I found another instance of TemporaryDirectory called with dir=os.getcwd(), which I think will lead to similar issue. I'm happy to fix it if that is preferred.

with (
tempfile.TemporaryDirectory(prefix="test", suffix=str(rank_zero_only.rank), dir=os.getcwd()) as tmp_dir,
dst_fs.open(dst_filepath, "wb") as dst_file,
):
src_filepath = os.path.join(tmp_dir, "tmp.prof")
profile.dump_stats(src_filepath)
src_fs = get_filesystem(src_filepath)
with src_fs.open(src_filepath, "rb") as src_file:
dst_file.write(src_file.read())

Fixes #20641

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--20642.org.readthedocs.build/en/20642/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Mar 14, 2025
Copy link

codecov bot commented Mar 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79%. Comparing base (bd9d114) to head (d755400).
Report is 111 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (bd9d114) and HEAD (d755400). Click for more details.

HEAD has 105 uploads less than BASE
Flag BASE (bd9d114) HEAD (d755400)
cpu 48 24
python 6 3
lightning_fabric 11 0
pytest 27 0
python3.10 12 6
lightning 31 15
gpu 3 0
python3.11 12 6
python3.12.7 18 9
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #20642     +/-   ##
=========================================
- Coverage      88%      79%     -9%     
=========================================
  Files         267      264      -3     
  Lines       23364    23309     -55     
=========================================
- Hits        20467    18354   -2113     
- Misses       2897     4955   +2058     

@Borda Borda merged commit eb082b2 into Lightning-AI:master Mar 14, 2025
80 checks passed
Borda pushed a commit that referenced this pull request Mar 18, 2025
(cherry picked from commit eb082b2)
lexierule pushed a commit that referenced this pull request Mar 18, 2025
(cherry picked from commit eb082b2)
Borda added a commit that referenced this pull request Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pl Generic label for PyTorch Lightning package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MLFlowLogger assumes cwd is writable
2 participants