[BUG] Open FlyteFile from remote path #2991
Open
+179
−6
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.
Tracking issue
Closes flyteorg/flyte#6090.
Why are the changes needed?
Directly opening a local or remote file with
FlyteFile
interface is quite useful. Also, this is commonly used with a context manager like:Following discuss both the local and remote cases:
FlyteFile
from a local pathIn this case, we don't need to download the file because it's already on the local file system. Hence, we just run a dummy downloading.
FlyteFile
from a remote path (our focus in this PR)As for the remote file, we definitely need to download the file from remote to our local file system before the file is accessed.
With this fix, users can directly open either a local or remote file in a consistent manner.
What changes were proposed in this pull request?
downloader
a static method ofFlyteFilePathTransformer
.FlyteFilePathTransformer
but doesn't need to interact with class or instance data.__fspath__
magic method ofFlyteFile
.How was this patch tested?
This patch is first tested with the following code snippet:
The result is shown as follows:
Setup process
Check all the applicable boxes
Related PRs
Docs link