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

[deprecated][core] Async Python bindings of C++ GcsClient. #46609

Closed
wants to merge 1 commit into from

Conversation

rynewang
Copy link
Contributor

@rynewang rynewang commented Jul 13, 2024

Superceded by #46788.

Implements async binding of C++ GcsClient in Python as NewGcsAioClient.

Previously we only have sync GcsClient bindings, ones that blocks on completion. To facilitate GcsAioClient we use python thread pool executor - one dedicated thread blocked for the sync call, whose underlying API is async. This is a big waste and we can do better.

The trick is to play the callback-to-async games wisely. Invoke a C++ async API with a python callback function; the callback serializes the reply data or exception, then switch to the python asyncio thread and complete a future. The future, in turn, is awaited by a postprocess function that does any python-side treatment (e.g. python protobuf deserialization, or converting to dict), then pass on to user code. The end result is an async method just like Python-native ones.

This PR adds the NewGcsAioClient and uses it as implementation of GcsAioClient by default. Can switch back to the OldGcsAioClient by RAY_USE_OLD_GCS_CLIENT=1.

@rynewang rynewang requested a review from a team as a code owner July 13, 2024 06:18
@rynewang rynewang added the go add ONLY when ready to merge, run all tests label Jul 13, 2024
Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
@rynewang rynewang assigned jjyao and rynewang and unassigned jjyao Jul 22, 2024
@rynewang rynewang changed the title [core] Async Python bindings of C++ GcsClient. [deprecated][core] Async Python bindings of C++ GcsClient. Jul 26, 2024
@rynewang rynewang removed the go add ONLY when ready to merge, run all tests label Jul 26, 2024
@rynewang rynewang closed this Jul 26, 2024
@rynewang
Copy link
Contributor Author

Superceded by #46788 for its manually doing CPython api calls to invoke python funcs etc. The new approach is to invoke cython-created function pointers.

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