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

Async/data persistence #2829

Merged
merged 16 commits into from
Oct 22, 2024
Merged

Async/data persistence #2829

merged 16 commits into from
Oct 22, 2024

Conversation

wild-endeavor
Copy link
Contributor

@wild-endeavor wild-endeavor commented Oct 17, 2024

Why are the changes needed?

A previous PR added async versions of the type engine. This change leverages that by converting flytekit's main I/O layer to async as well.

What changes were proposed in this pull request?

  • Added a new function to get the async version of an fsspec filesystem. This takes care of calling fsspec with the current loop.
  • Fix to get_filesystem to take into account passed in kwargs even if no special if condition handling is present (this affected using https filesystem).
  • Added async versions of the popular functions.
  • Updated some type transformers to async.

How was this patch tested?

Tested locally and then tested on internal clusters. Performance benefit is mainly noticeable across large number of small files. A task that produces a list of 1000 files, 2MB each, decreases from around 135s to about 40s on a t3a.xlarge. No improvement is seen for folders because those were already async.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.79%. Comparing base (1f8a273) to head (4a8c936).
Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2829      +/-   ##
==========================================
- Coverage   87.23%   82.79%   -4.45%     
==========================================
  Files          26        3      -23     
  Lines        1426      186    -1240     
==========================================
- Hits         1244      154    -1090     
+ Misses        182       32     -150     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wild-endeavor wild-endeavor marked this pull request as ready for review October 18, 2024 23:21
@wild-endeavor wild-endeavor changed the title Async/data p Async/data persistence Oct 18, 2024
Signed-off-by: Yee Hing Tong <[email protected]>
return fsspec.filesystem(protocol, **storage_options)
return fsspec.filesystem(protocol, **kwargs)

def get_async_filesystem_for_path(self, path: str = "", anonymous: bool = False, **kwargs) -> AsyncFileSystem:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def get_async_filesystem_for_path(self, path: str = "", anonymous: bool = False, **kwargs) -> AsyncFileSystem:
async def get_async_filesystem_for_path(self, path: str = "", anonymous: bool = False, **kwargs) -> AsyncFileSystem:

@thomasjpfan
Copy link
Member

thomasjpfan commented Oct 20, 2024

Can you share the code that you used for benchmarking?

@wild-endeavor
Copy link
Contributor Author

Can you share the code that you used for benchmarking?

https://github.com/unionai/debugyt/blob/master/user/ytong/src/yt_dbg/data_perf/measure_wfs.py
@thomasjpfan

@eapolinario
Copy link
Collaborator

kf-pytorch tests are hanging (notice how they ran for 5h+): https://github.com/flyteorg/flytekit/actions/runs/11451023024/job/31860491868?pr=2829#step:7:1

I kicked off a re-run but it seems like it's also hanging.

Signed-off-by: Yee Hing Tong <[email protected]>
Copy link
Collaborator

@eapolinario eapolinario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing.

@wild-endeavor wild-endeavor merged commit 3fc51af into master Oct 22, 2024
104 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants