pymilvus
pymilvus copied to clipboard
[FEATURE]: asyncio support
Is there an existing issue for this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe.
Is there any chance that PR adding asyncio support will be accepted?
If yes, do maintainers have a vision of how should it be implemented? E. g. create async version of existing classes like AsyncCollection with same interface as Collection, but async versions of methods like async def search(...). Or maybe add an optional argument def search(_awaitable: bool = False) similar to existing _async, but forcing the method to return an awaitable instead of future object? Or implement something like async def async_search(...) in existing Collection class.
Describe the solution you'd like
No response
Describe alternatives you've considered
Also, do you have considerations related to desired implementation? E. g. is it okay to implement asyncio support as a simple wrapper around asgiref and add asgiref as a project dependency (which may be not so elegant solution)?
Anything else?
There was an issue on this topic, but author closed it (probably, because found a solution for their use-case)
https://github.com/milvus-io/pymilvus/issues/1190
Is there an existing issue for this?
- [x] I have searched the existing issues
Is your feature request related to a problem? Please describe.
Is there any chance that PR adding
asynciosupport will be accepted?If yes, do maintainers have a vision of how should it be implemented? E. g. create async version of existing classes like
AsyncCollectionwith same interface asCollection, but async versions of methods likeasync def search(...). Or maybe add an optional argumentdef search(_awaitable: bool = False)similar to existing_async, but forcing the method to return an awaitable instead of future object? Or implement something likeasync def async_search(...)in existingCollectionclass.Describe the solution you'd like
No response
Describe alternatives you've considered
Also, do you have considerations related to desired implementation? E. g. is it okay to implement asyncio support as a simple wrapper around asgiref and add
asgirefas a project dependency (which may be not so elegant solution)?Anything else?
There was an issue on this topic, but author closed it (probably, because found a solution for their use-case)
#1190
Most of the pymilvus already support async.
If you look at search params, you will see _async and _callback params, I guess that's what you are looking for
I would say user could do it by themselves. Since pymilvus is hard to control the threadpool size or what. But on the other side, maybe we can have some example about how to maintain pool to work with Milvus? @XuanYang-cn @filip-halt
actually I still think async style would be better. one actor can submit request asyncly and another actor check the result
AFAIK, all the pymilvus calls are blocking so you should run them on another thread (await loop.run_in_executor(coro)). However, this approach seems to be not so efficient compared with ordinary async-await logics. So async-module for pymilvus is highly desirable feature, agree with @belkka.
This is also relevant to my use case, it looks like this got prioritised for the 2.3.0 release?
should think about it. Anyone want to contribute on it?
should think about it. Anyone want to contribute on it?
I'm willing to contribute. Any heads-up before I start contributing, other than the stuff mentioned in CONTRIBUTING.md
I was checking out this Pull Request, for the async support, any reason it is stuck ?
@mistborn17 looks like at some point maintainers wanted to deprecate orm module (in dev branch), so I stopped working on the PR. Apparently, they changed their mind later. Though, I have not received feedback about whether or not I should continue working in same direction/do they like selected approach (interface/implementation). Right now PR has some minor conflicts (type annotations were added into master since then).
async,await like I think is good. Can anyone continue working on this?orz
Anyone volunteered?