-
Notifications
You must be signed in to change notification settings - Fork 104
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
[WIP] Fixing extra download for filesystem's localization #254
Draft
oandreeva-nv
wants to merge
8
commits into
main
Choose a base branch
from
oandreeva_localization_fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e5a40b7
Adding ability to specify subdirectory to download for `LocalizePath`
oandreeva-nv 8474fa0
Generalized implementation of : added recursive flag and mount_dir
oandreeva-nv 8511943
Added comments
oandreeva-nv af94ad7
Added allow_dir_exist to MakeDirectory + clarified comments
oandreeva-nv 2bd9a25
Apply similar changes to gcs
oandreeva-nv 6903e1c
Apply similar changes to AZURE
oandreeva-nv c5ded7e
Add allow_dir_exist to AS::DownloadFolder
oandreeva-nv d35a794
Adjusted azure mkdir for Win
oandreeva-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the interface is insufficiently generic for functions at the level of
LocalizePath()
, becauseLocalizePath()
should be available to any callers who want to localize any path on the cloud, butfetch_subdir
imposes a limitation on the caller to either fetch all sub-directories within the path or only the sub-directory specified. The caller may not "choose" which sub-directories to fetch or not fetch. let alone choosing sub-directories within a sub-directory.I think there are many different generic design choices. For example:
bool recursive
instead ofstring fetch_subdir
. The caller can choose not fetching any sub-directories withrecursive = false
or all sub-directories withrecursive = true
. Then, the problem can be accomplished by first fetching the given model path withrecursive = false
(i.e./repo/model
) and then the model path with version withrecursive = true
(i.e./repo/model/1
). However, this will require theLocalizedPath
object to be able to join the model path and model version path localization objects into one localization object.However, the interface accomplishes exactly what we want to solve at this time. I will defer to @GuanLuo and @nnshah1 to decide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we? If I understand correctly, versioned path is set here:
core/src/backend_model.cc
Lines 113 to 114 in a23786c
so instead of
we would do something like:
or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking something like:
The idea behind
LocalizedPath::Include()
is to joinand
to
on the local disk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually am missing something. Even though I like option 1 suggestion, localization in this case will happen to another directory. Meaning, at current stage every call to
LocalizePath
creates a new temporary directory. Thus if we separately will try to load model and its version, they will be copied in 2 different directories. So unless we want to change that, option 1 is not the best option.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be ok to only implement the base case above, and throw an error if the caller is trying to join/include anything more complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on offline discussion, with @kthui, we can add one more parameter
location
to control where to localize provided path, i.e. something likeThen we can control where version directory will be localized , and if
location
is empty, we create a new, temporary directory.This will also help with the follow up ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking on the same direction as
LocalizedPath::Include()
that if we want to have a generic way to localizing directories (with customization on fetching subset of contents / recurrsiveness), we want to makeLocalizedPath
a "filler" class: as on callingfs::LocalizePath
, it returns an fully localized object (current) or empty object (with local root path assigned). Then if user want to customize the localization, they can call:Although I think it then the process is convoluted that there is a iterative calls of
GetDirectorySubdirs/Files
andLocalizedPath::Include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is really an internal API (unless we want to expose file system API in the future) so we are free to modify the interface as frequent as we want and don't need to worry about being generic. If localizing model directory is somewhat specific, we may just introduce a
LocalizeModelDirectory
method to fit the specific need.Because when you look at what to be localized for a model version, it is actually "everything in the directory except for the unwanted version subdirectories (integer-named directories)", that is tricky to express it with some generic language.