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

[FEAT] Asyncio support #2411

Merged
merged 7 commits into from
Dec 16, 2024
Merged

[FEAT] Asyncio support #2411

merged 7 commits into from
Dec 16, 2024

Conversation

brcarry
Copy link
Contributor

@brcarry brcarry commented Dec 5, 2024

  • Support async delete, get, insert, query, search, hybrid_search, upsert, create_collection, drop_collection, describe_collection
  • Support adding interceptor to aio channel
  • Retry checking connect state instead of channel_ready_future in connect_milvus

- Support async delete, get, insert, query, search, hybrid_search, upsert, create_collection, drop_collection, describe_collection
- Support adding interceptor to aio channel
- Retry checking connect state instead of channel_ready_future in connect_milvus

Signed-off-by: Ruichen Bao <[email protected]>
@XuanYang-cn
Copy link
Contributor

/hold

pymilvus/client/async_grpc_handler.py Show resolved Hide resolved
pymilvus/client/async_grpc_handler.py Outdated Show resolved Hide resolved
pymilvus/client/async_grpc_handler.py Outdated Show resolved Hide resolved
… "_async" check, optimize "_wait_for_channel_ready"

- Refactor AsyncGrpcHandler to inherit GrpcHandler Class, enabling reuse of existing sync methods
- Remove unnecessary "_async" check in async methods
- Replace previous polling logic `_async_channel.get_state()` by `_async_channel.channel_ready()` in `_wait_for_channel_ready`

Signed-off-by: Ruichen Bao <[email protected]>
- Provide only asynchronous interfaces in AsyncMilvusClient
- Convert `_prepare_row/batch_insert/upsert_request`, `create_index`, and `load_collection` and their related functions to asynchronous implementations
- Retain only functions being used in async_utility.py

Signed-off-by: Ruichen Bao <[email protected]>
Copy link
Contributor

@XuanYang-cn XuanYang-cn left a comment

Choose a reason for hiding this comment

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

Please add some examples codes in examples/async

pymilvus/orm/async_connections.py Outdated Show resolved Hide resolved
… for async client

- Update `__init__.py` to allow importing AsyncMilvusClient
- Add a simple code example for AsyncMilvusClient
- Add the previously missing `_async_create_collection_with_schema` method

Signed-off-by: Ruichen Bao <[email protected]>
@mergify mergify bot added needs-dco and removed dco-passed labels Dec 13, 2024
- Add `_async` parameter in `connections.py` to determine whether to establish a synchronous or asynchronous connection
- Fix `__all__` is not sorted in `__init__.py` which failed in code lint check

Signed-off-by: Ruichen Bao <[email protected]>
examples/simple_async.py Outdated Show resolved Hide resolved
pymilvus/client/async_grpc_handler.py Outdated Show resolved Hide resolved
pymilvus/milvus_client/async_milvus_client.py Show resolved Hide resolved
- Rename `async_*` methods as `async def` already indicates this is an async method. For example: `async_create_collection` → `create_collection`
- Add a class doc for `AsyncMilvusClient`
- Remove commented-out code in example

Signed-off-by: Ruichen Bao <[email protected]>
@czs007
Copy link
Contributor

czs007 commented Dec 16, 2024

/approve
/lgtm

@czs007
Copy link
Contributor

czs007 commented Dec 16, 2024

/unhold

@XuanYang-cn XuanYang-cn self-requested a review December 16, 2024 12:40
@sre-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brcarry, czs007, XuanYang-cn

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot sre-ci-robot merged commit f269c8b into milvus-io:master Dec 16, 2024
11 checks passed
Copy link

mergify bot commented Dec 17, 2024

⚠️ The sha of the head commit of this PR conflicts with #2455. Mergify cannot evaluate rules on this PR. ⚠️

@czs007 czs007 mentioned this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants