fix: honor index_path when input_dir is a local directory#839
Open
javierdejesusda wants to merge 1 commit into
Open
fix: honor index_path when input_dir is a local directory#839javierdejesusda wants to merge 1 commit into
javierdejesusda wants to merge 1 commit into
Conversation
The index_path copy was gated behind isinstance(input_dir.url, str), so a user-provided index_path was silently ignored when input_dir is a local directory (url is None), raising a misleading "doesn't contain any index.json file" error. Copy the provided index into the local cache regardless of whether input_dir.url is a string.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #839 +/- ##
===================================
Coverage 81% 81%
===================================
Files 54 54
Lines 7671 7671
===================================
+ Hits 6186 6191 +5
+ Misses 1485 1480 -5 🚀 New features to boost your workflow:
|
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.
Before submitting
What does this PR do?
Fixes #800.
When
input_dirpoints to a local directory, a user-providedindex_pathwas ignored and loading failed. Indataset_utilities.pythe branch that copiesindex.jsonfromindex_pathinto the cache directory was nested insideisinstance(input_dir.url, str), so it only ran for remote inputs. For a localinput_dirtheurlisNone, the branch was skipped, the index was never materialized into the cache path, and the dataset could not resolve.The fix checks
index_pathfirst, independent of whether the input is local or remote: ifindex.jsonis not already cached and an explicitindex_pathwas provided, copy it into the cache path. The existing remote-download branch is preserved for the case where noindex_pathis given.Added
test_subsample_streaming_dataset_with_local_index_path, which uses a localinput_dirwith noindex.jsonplus anindex_pathin a separate directory, and asserts that subsampling resolves correctly and the index is materialized into the local dataset directory. It fails onmainand passes with this change.