Thriftpy/thriftpy

asyncio client/server support

Opened this issue · 7 comments

Hi,

I'm looking for a way to run thrift with asyncio, the fbthrift fork has some examples (https://github.com/facebook/fbthrift/blob/master/thrift/tutorial/py.asyncio/PythonServer.py), i like the idea of a pure python without having to pregenerate code implementation like this but i've seen no mention of asyncio, apparently it works on py3 and already has some tornado examples so my question is, is it reasonably to work on supporting asyncio here? I could send a PR but i wanted to touch base before jumping into coding.

Any pointers would be helpful.

Thanks.

lxyu commented

It would be great to have an asyncio server implementation, while currently we don't have much time on new feature development, PR is very welcome!

Is there any place where i can make some technical questions about thriftpy? Like an irc or some other place? I got some questions regarding some of the internals.

One specific question, i'm getting "struct.error: unpack requires a bytes object of length 4" in thriftpy/protocol/binary.py while calling self.processor.process(self.in_protocol, self.out_protocol) in my code, which will now explain why you had that complex code to handle frames in tornado.py, why do we need to read frame by frame? Or am i missing something?

I would be very interested in an asyncio implementation. Did you do any additional work on this feature?

I attempted to implement it but it got really complicated for me, i have
some synchronization issues that i'm not sure how to properly resolve the
way things are implemented in thriftpy. I tried to model it following the
tornado implementation but i got lost.

On Mon, Nov 21, 2016 at 2:12 PM, kyeatman74 notifications@github.com
wrote:

I would be very interested in an asyncio implementation. Did you do any
additional work on this feature?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#246 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA13LDIt3sL8a1-hJulLhWxJ9wuJSSApks5rAdEZgaJpZM4KWWoB
.

Thanks for the quick response! I may spend some time on it, if only to better understand all the pieces. If I get something working, I will put it out there for everyone.

Sorry for bumping an old thread! I put together a minimal client/server implementation, and opened a PR for it here: https://github.com/eleme/thriftpy/pull/299/files

Unfortunately, I'm having some trouble getting the tests to pass under travis-ci - any help would appreciated!