-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix MLFlowLogger.save_dir Windows file URI handling #20988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix MLFlowLogger.save_dir Windows file URI handling #20988
Conversation
|
@lantiga @williamFalcon , @Borda @ethanwharris @tchaton @justusschock Let me know your comments. Any changes I need to get this PR approved? It has been 2 weeks. |
41d41c0 to
c370a89
Compare
|
@littlebullGit this requires @williamFalcon only as he is the single code-owner for loggers |
196e27e to
d248b61
Compare
d0ef6b4 to
2025782
Compare
|
The failed check has nothing to do with the code fix. We can rerun the test once @williamFalcon reviewed the code. |
2025782 to
952e2ed
Compare
|
just rebased the PR |
- Replace simple string slicing with urllib.parse.urlparse and url2pathname - Properly handle Windows absolute file URIs (e.g., file:///C:/path) - Add comprehensive tests for various file URI formats - Fix malformed paths like ///C:/path becoming C:/path on Windows Fixes Lightning-AI#20972
- Handle both proper file URIs (file:///path) and legacy format (file:/path) - Proper URIs use urlparse/url2pathname for Windows compatibility - Legacy format used by constructor returns path as-is - Update tests to cover both formats and Windows behavior
6c52a05 to
de52cd6
Compare
|
build error did not seems related to my changes. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #20988 +/- ##
=========================================
- Coverage 87% 79% -8%
=========================================
Files 269 266 -3
Lines 23804 23755 -49
=========================================
- Hits 20626 18732 -1894
- Misses 3178 5023 +1845 |
Fix MLFlowLogger.save_dir Windows file URI handling
What does this PR do?
Fixes #20972
This PR fixes a bug in
MLFlowLogger.save_dirwhere Windows absolute file URIs were being incorrectly parsed, resulting in malformed local paths that causedFileNotFoundErroron Windows systems.Problem:
When using [MLFlowLogger] with Windows absolute file URIs (e.g.,
file:///C:/Dev/example/mlruns), the [save_dir] property would return malformed paths like///C:/Dev/example/mlrunsinstead of the expectedC:/Dev/example/mlruns, causing file system operations to fail.Solution:
urllib.parse.urlparseandurllib.request.url2pathnamefile:///C:/path)///C:/pathbecomingC:/pathon WindowsChanges:
MLFlowLogger.save_dirproperty to use standard library URI parsing methods📚 Documentation preview 📚: https://pytorch-lightning--20988.org.readthedocs.build/en/20988/