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

Introduce WeaviateAsyncClient as async alternative to WeaviateClient #1007

Merged
merged 94 commits into from
Jul 9, 2024

Conversation

tsmith023
Copy link
Contributor

@tsmith023 tsmith023 commented Apr 12, 2024

  • Changes base implementation to be purely async using httpx and grpc.aio
  • Uses base implementation in WeaviateAsyncClient directly
  • A class decorator pattern wraps the async implementation in the sync routes replicating the arguments and docstrings automagically @dirkkul
  • The API surface itself must be duplicated however through .pyi stub fails due to this runtime patching
  • Replace WeaviateClient internal calls with event-loop-wrapped blocking calls using the base async implementation
  • An event loop thread is spun up by the client at instantiation as a global singleton that is used in all calls
  • client.batch is only available on the WeaviateClient object, since it is a purely sync algorithm. It depends on the new higher-level event loop thread

- Changes base implementation to be purely async using `httpx` and `grpclib`(instead of google's grpc due to [issues](grpc/grpc#25364))
- Uses base implementation in `WeaviateAsyncClient` directly
- Subdivides the codebase into `**/asy/*.py` and `**/sy/*.py` directories within each namespace directory
- Replace `WeaviateClient` internal calls with event-loop-wrapped blocking calls using the base async implementation
- `WeaviateClient` spins up its own personal event loop thread that it schedules async calls to. Should this be a global singleton instead?
- `client.batch` is only available on the `WeaviateClient` object, since it is a purely sync algorithm. It depends on the new higher-level event loop thread
@weaviate-git-bot
Copy link

Great to see you again! Thanks for the contribution.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Slack channel?

@rolandgvc
Copy link

I'm following this as well. I'm looking forward to the async client :)

@tsmith023 tsmith023 self-assigned this May 15, 2024
@tsmith023 tsmith023 added the enhancement New feature or request label May 15, 2024
@tsmith023 tsmith023 changed the base branch from main to dev/1.26 July 1, 2024 09:59
Copy link
Collaborator

@dirkkul dirkkul left a comment

Choose a reason for hiding this comment

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

I think we tested enough :)

@dirkkul dirkkul merged commit fc42165 into dev/1.26 Jul 9, 2024
149 of 150 checks passed
@dirkkul dirkkul deleted the implement-async-client branch July 9, 2024 09:53
@gokturkDev
Copy link

Hi when is this going to be in the release version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Async Client to be able to make asynchronous requests
6 participants