-
Notifications
You must be signed in to change notification settings - Fork 387
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
Kazoo for asyncio #185
Comments
|
The problem that is every method like Also do you think it's reasonable to submit pull requests for small parts of the code, adapting various things to asyncio, before the real handler will be ready? I.e. I need to refactor |
How will older version of python work with this change?
|
You will not be able to import the module (because of yield from) The hack like trollius do, is much slower than native yield from. |
Cool, be interesting to see how this would work out. |
you could make a asyncio handler that returned asyncio future subclass async result. As long as you only call the async method names you can yield from them because they are futures :P |
There is no reason to use yield from inside kazoo distributed code, just use the callback interface of asyncio. That way trollius people can also use it. |
I'm not sure this can be done while maintaining Python 2 compatibility without performance issues. Maybe a hacky workaround might do something like....
Until we can abandon Python 2 entirely this seems the most reasonable way to use kazoo under async environments that can't yield inline as gevent's can. Maybe I should write up some docs on how to do this as its not too bad in practice (I do lots of calls like this using tornado + Python 3.4 + ThreadPoolExecuter). Also, when it comes to things like watches and such, you'd have to make special funcs to 'bridge' from the thread back to the async loop by setting a result on a shared future object or something. |
Any update on this ? |
IMO, the threading handler could work well in Python 3 without gevent. It will not be a performance issue because there is only one background threading to keep the state of ZooKeeper session, and it never spawns again in the same client. We could have a thin wrapper to make methods like |
I'd like to move to using asyncio as it would drastically simplify a lot of issues in kazoo. I don't think it makes sense to move to asyncio without dropping Python 2 support and I'd like to understand the versions in use by kazoo users more fully before dropping it entirely. Trollius diverges a bit from async in Python 3, and there's the issue that async in Python 3 itself undergoes changes from 3.4 -> 3.4.1 -> 3.4.2 -> 3.5, which is rather annoying. I've already backported Python 3.5 async functions to work in 3.4.1 once, it was miserable and I wouldn't recommend it to anyone. An alternative would be a kazoo branch that goes Python 3.5+ only, so we could use nice async/await syntax with all the asyncio things. |
Trollius is a dead project, the author has abandoned it as un-workable.
…On Thu, Jun 1, 2017 at 3:15 PM Ben Bangert ***@***.***> wrote:
I'd like to move to using asyncio as it would drastically simplify a lot
of issues in kazoo. I don't think it makes sense to move to asyncio without
dropping Python 2 support and I'd like to understand the versions in use by
kazoo users more fully before dropping it entirely. Trollius diverges a bit
from async in Python 3, and there's the issue that async in Python 3 itself
undergoes changes from 3.4 -> 3.4.1 -> 3.4.2 -> 3.5, which is rather
annoying.
I've already backported Python 3.5 async functions to work in 3.4.1 once,
it was miserable and I wouldn't recommend it to anyone. An alternative
would be a kazoo branch that goes Python 3.5+ only, so we could use nice
async/await syntax with all the asyncio things.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#185 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMPCdKYUlIVAy8NpC6yReuEr80Whxfqks5r_xvkgaJpZM4BtUpJ>
.
|
@fried ah, thanks, I thought I heard something like that. |
Ya, IMHO the whole async stuff is yet-another-rift that the upstream python developers caused (without even calling it python 4.0) and I'm not even sure how many people/developers see that yet. I'd also be in favor of a branch that goes 3.5+ only. It'd be easier (imho) to make that work than trying to shoe-horn both systems under the same umbrella (likely badly). |
Hi,
I need an zookeeper protocol implementation for asyncio. While it seems kazoo supports different asynchronous APIs it relies on python stack in a way that doesn't allow integration with asyncio, which needs
yield from
on every suspension point. So:The text was updated successfully, but these errors were encountered: