-
Notifications
You must be signed in to change notification settings - Fork 64
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
Support asyncio #109
Comments
👍 looking forward to this! |
Here is aiomotorengine which is fully based on motorengine. Code and tests were rewritten using the asyncio's event loop and native coroutines (using |
nice job! |
Good job guys! |
@ilex why did you made it as separate project, and not as pull request? i guess we dont need that level of fragmentation (aiomotorengine which is port of motorengine which is port of mongoengine which is trying to be like django orm) |
@ilex and if you still decide to keep separate repo anyway, i believe you should respect other contributors work and rebase repo to full commit history with patches of your own. |
I haven't looked at the implementation level, but pymongo and motor are
On Sat, Dec 12, 2015 at 10:29 AM, Vyacheslav Linnik <
|
Both |
@linnik i agree with you it's the best way but it seems to me that to meet requirement of supporting different event loops motorengine should be redesigned a bit. Because motor for example was designed to support different event loops. and i think i am really not the one who can do that at the moment. |
@linnik i think the one way it could be done is to for example make a subfolder motorengine/asyncio/ and put here async logic mostly by inheriting classes as QuerySet and overriding async methods. Actually last week i tried to do it with connection.py and database.py so the code of motorengine/asyncio/database.py could be as follow: import asyncio
from ..database import Database as MotorEngineDatabase
class Database(MotorEngineDatabase):
@asyncio.coroutine
def ping(self):
return (yield from self.connection.admin.command('ping')) so now we can do something like this: import asyncio
from motorengine.asyncio import connect
io_loop = asyncio.get_event_loop()
db = connect('test', io_loop=io_loop)
io_loop.run_until_complete(db.ping()) But it still requires to apply changes to asyncio version of ping when someone change something in motorengine's version of ping |
I like this approach a lot better. I aggree that the fragmentation hurts the community. As a matter of fact, we have an issue with mongoengine to merge our code with theirs and support tornado in mongoengine. |
It seemed like that I missed almost all the conversation due to my final. In my opinion, I think if you want to integrate You can use http://www.tornadoweb.org/en/stable/concurrent.html#tornado.concurrent.Future https://docs.python.org/3/library/asyncio-task.html#asyncio.Future |
Also, if you have problems on working alone, we can figure out this together. |
I have never used motorengine, but have experience with motor (asyncio part), I would suggest to use separate libraries or at least completely separate modules:
Ideal approach is to decouple io as much as possible from protocol parsers and orm so io part could be written in any framework. |
The Autobahn project uses the txaio library to support both Twisted and Asyncio in the same codebase. Tornado and Asyncio are much more similar in terms of API, so this should be even easier. |
@heynemann could you formulate what requirements you have to get asyncio support merged into motorengine? My colleague rebased @ilex work onto the current master of motorengine here: https://github.com/BFriedrichs/motorengine |
Out of curiosity, what's the state of making a PyPI release with the asyncio modules? I'm working with the excellent Starlette and would love to see motorengine support asyncio. |
JOOI - is there any prospect of this? |
Guys, I don't have time to work on this. If anyone wants to join the project, I'd be more than willing to welcome new commiter(s), as long as they send a few PRs first, that is :) Any of you guys want to get this done? |
Motor supported asyncio in its 0.5 version.
This ORM can support asyncio and/or native coroutine through Motor 0.5.
Can you provide the asyncio support?
The text was updated successfully, but these errors were encountered: