Repository navigation
Add asyncio event loop support - #4071
Conversation
|
That's really cool, thanks a lot for the pull request @takluyver ! @Tryneus I think this is one for you to review. Can you take a look when you find the time? @takluyver Have you signed our CLA yet? http://rethinkdb.com/community/cla/ |
There was a problem hiding this comment.
This should be asyncio, not Tornado - and the gen.Return(None) thing isn't quite true when using yield from.
There was a problem hiding this comment.
I think the same problem would still arise - return foo in a coroutine still works by raising StopIteration(foo), I believe. I'll update the comment.
|
@takluyver, thanks for putting this up, it looks great, although I made a few comments/suggestions. |
|
Thanks, I was fully expecting that it wouldn't be quite right. I'll respond to comments inline. @danielmewes I just went and signed the CLA now. The address field mentioned that you might send me something - if that's a t-shirt, then save yourselves the postage, because I already picked up two at PyCon. ;-) |
|
Good to know about the shirts @takluyver :) |
There was a problem hiding this comment.
Is there a reason these tests are commented out? Were they taking too long? If I remember correctly they're the longest-running tests in the suite.
There was a problem hiding this comment.
Oh, I was commenting out chunks of the tests just so that I could run them quickly. I didn't mean to commit them commented out.
|
Tests are now uncommented and passing, and I think I've addressed all of the review comments so far. |
|
Awesome, looks great, @takluyver! Merging this into Thanks for all the help! |
Add asyncio event loop support
|
You're welcome :-) |
Add asyncio event loop support
This probably needs quite a bit of work, but it's working for a basic example, and I wanted to communicate early. @techdragon talked me into working on this at the PyCon sprints.
Asyncio is part of the standard library in Python 3.4. It's a rather similar API to tornado, so I copied and pasted the net_tornado code that's already in rethinkdb and modified it until it works. The syntax is only valid on Python 3, but the module shouldn't be imported until you do
r.set_loop_type('asyncio'), so that shouldn't be a problem.Here's the asyncio version of the tornado example from your async drivers blog post (BTW, that example is missing a colon on the
whileline):