Skip to content
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

[Docs] add streaming support example for file and directory #5879

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/user_guide/data_types_and_io/flytedirectory.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,21 @@ You can run the workflow locally as follows:
:lines: 94-114
```


## Streaming support

Flyte `1.5` introduced support for streaming `FlyteDirectory` types via the `fsspec` library.
The `FlyteDirectory` streaming feature enables efficient streaming and handling of entire directories, simplifying operations involving multiple files.

:::{note}
This feature is marked as experimental. We'd love feedback on the API!
:::

Here is a simple example, you can accept a `FlyteDirectory` as an input, walk through it and copy the files to another `FlyteDirectory` one by one.

```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/ddce0448141ea6d2cb148df52bf408874adb15ad/examples/data_types_and_io/data_types_and_io/file_streaming.py
:caption: data_types_and_io/file_streaming.py
:lines: 23-33
```

[flytesnacks]: https://github.com/flyteorg/flytesnacks/tree/master/examples/data_types_and_io/
16 changes: 16 additions & 0 deletions docs/user_guide/data_types_and_io/flytefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,20 @@ You can enable type validation if you have the [python-magic](https://pypi.org/p
Currently, type validation is only supported on the `Mac OS` and `Linux` platforms.
:::

## Streaming support

Flyte `1.5` introduced support for streaming `FlyteFile` types via the `fsspec` library.
This integration enables efficient, on-demand access to remote files, eliminating the need for fully downloading them to local storage.

:::{note}
This feature is marked as experimental. We'd love feedback on the API!
:::

Here is a simple example of removing some columns from a CSV file and writing the result to a new file:

```{rli} https://raw.githubusercontent.com/flyteorg/flytesnacks/ddce0448141ea6d2cb148df52bf408874adb15ad/examples/data_types_and_io/data_types_and_io/file_streaming.py
:caption: data_types_and_io/file_streaming.py
:lines: 8-20
```

[flytesnacks]: https://github.com/flyteorg/flytesnacks/tree/master/examples/data_types_and_io/
Loading