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

Move to Async Read/Writes #121

Merged
merged 1 commit into from
Jan 9, 2023
Merged

Conversation

blester125
Copy link
Collaborator

This PR updates the our clean and smudge filters to use async to do I/O bound operations (mostly tensorstore serialization and running git-lfs-(clean|smudge)). This is done with an async wrapper of subprocesses that mimics subprocess.run. It also includes tools for running an async function on all the k, v pairs in a dictionary so that they will happen concurrently.

The main async entry point is in the clean and smudge filters where the cleaning (or smuding) function is applied to each leaf in the parameter tree concurrently.

This also updates the Update API a little bit. This update makes async possible (i.e. some methods are converted from def to async def) and it also makes the API easier for writing new update plugins. Additionally the serializer is now passed to the update class and used internally instead of being used externally. Also things like communication with git-lfs is now done in the write method explicitly instead of being part of the LfsMeatadata creation.

There are still some change wrt to documentation, typing, and the exact Updater API but I wanted to get eyes on it sooner rather than later.

git_theta/file_io.py Outdated Show resolved Hide resolved
git_theta/git_utils.py Outdated Show resolved Hide resolved
git_theta/params.py Outdated Show resolved Hide resolved
git_theta/updates/base.py Outdated Show resolved Hide resolved
git_theta/updates/base.py Show resolved Hide resolved
git_theta/updates/base.py Outdated Show resolved Hide resolved
@nkandpa2
Copy link
Collaborator

No issue for me with the direction of the Update API and async clean/smudge/push.

@blester125
Copy link
Collaborator Author

closes #61

@blester125 blester125 force-pushed the feat/async branch 3 times, most recently from e7c69ba to 7aff100 Compare January 6, 2023 13:32
This PR updates the our clean and smudge filters to use async to do I/O
bound operations (mostly tensorstore serialization and running git-lfs-(clean|smudge)). This is done with an async wrapper of subprocesses that mimics subprocess.run. It also includes tools for running an async function on all the k, v pairs in a dictionary so that they will happen concurrently.

The main async entry point is in the clean and smudge filters where the
cleaning (or smuding) function is applied to each leaf in the parameter
tree concurrently.

This also updates the Update API a little bit. This update makes async
possible (i.e. some methods are converted from `def` to `async def`) and
it also makes the API easier for writing new update plugins. Additionally
the serializer is now passed to the update class and used internally
instead of being used externally. Also things like communication with
git-lfs is now done in the write method explicitly instead of being part
of the LfsMeatadata creation.
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.

2 participants