[ 
https://issues.apache.org/jira/browse/THRIFT-1704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13465337#comment-13465337
 ] 

Jake Farrell commented on THRIFT-1704:
--------------------------------------

Chris, thank you for the initial work on this patch. The latest stable version 
of tornado should be supported, currently its 2.4.0 so the patch is good in 
that regard. 

The unit tests should not fail if tornado support is not being used or 
available as this will be an optional configuration type
                
> Tornado support (Python)
> ------------------------
>
>                 Key: THRIFT-1704
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1704
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Python - Compiler, Python - Library
>    Affects Versions: 0.9
>         Environment: Tornado 2.4.0 
> (https://github.com/facebook/tornado/tree/v2.4.0)
>            Reporter: Chris Piro
>         Attachments: thrift-1704-tornado.patch
>
>
> Add support for Tornado, the non-blocking server framework released by 
> Facebook. The attached patch adds a {{--gen py:tornado}} option to the 
> compiler, support bits to Python library, a tutorial server and client, and a 
> modest unit test.
> The attached patch (against {{trunk}}) has been running in the critical path 
> of a production web site for several months with modest load. It seems to 
> work fine, though no serious attempt has been made to optimize for 
> performance.
> some snippets from the tutorial server and client code, respectively:
> {code}
> class CalculatorHandler(object):
>     def add(self, n1, n2, callback):
>         callback(n1 + n2)
> def main():
>     handler = CalculatorHandler()
>     processor = Calculator.Processor(handler)
>     pfactory = TBinaryProtocol.TBinaryProtocolFactory()
>     server = TTornado.TTornadoServer(processor, pfactory)
>     server.bind(9090)
>     server.start(1)
>     ioloop.IOLoop.instance().start()
> {code}
> {code}
> transport = TTornado.TTornadoStreamTransport('localhost', 9090)
> pfactory = TBinaryProtocol.TBinaryProtocolFactory()
> client = Calculator.Client(transport, pfactory)
> yield gen.Task(transport.open)
> yield gen.Task(client.ping)
> sum_ = yield gen.Task(client.add, 1, 1)
> print "1 + 1 = {}".format(sum_)
> {code}
> particular concerns:
> * The library and generated code has only been tested with Tornado 2.4.0. Is 
> there a preferred spot to note that dependency?
> * The unit test relies on Tornado to run and will fail if it's not available 
> at {{make check}} time. What's the proper way to depend on Tornado / skip the 
> test where Tornado is unavailable?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to