Is there any way to asynchronously pass Thrift protocol through Tornado web server?
Asked
Active
Viewed 2,681 times
6
-
Can I implement an analog "pyamf + Django" - "thrift + tornado". While maintaining a async work? – DarkAnthey Apr 15 '11 at 16:45
3 Answers
2
twisted: Generate Twisted-friendly RPC services.
tornado: Generate code for use with Tornado.
The command is thrift -gen py:tornado -out ./ hello.thrift

lifei
- 235
- 2
- 10
0
Async indeed includes two parts: tornado async response to reqeust, function aysnc communitation with thrift server.
Tornado supports aysnc response. You can refer to Tornado Async HTTP returning results incrementally and Tornado Asynchronous Handler
thrift aysnc communication. You can refer to https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/, although using Java, i think it'll helpful.
0
The simplest way to call a blocking function from a coroutine is to use a ThreadPoolExecutor, which returns Futures that are compatible with coroutines:
thread_pool = ThreadPoolExecutor(4)
@gen.coroutine
def call_blocking():
yield thread_pool.submit(blocking_func, args)
the blocking_func may your thrift function.

Shuguang Yang
- 370
- 1
- 4
- 12