python 3 pyramid async solution

406 views
Skip to first unread message

Mehdi

unread,
Dec 24, 2014, 4:14:05 PM12/24/14
to pylons-...@googlegroups.com
Hi
In part of my app i have to run a long process on server and at the end send the result to client. so i am looking for kind of async view/response/... to push some messages to client while process continues on server.

There is some good solution for python 2.x like gevent, but i'm using python 3.3.
So far i found pyzmq which seems does the job, but there is another problem with waitress and response buffering issue. i also try gunicorn which i end up with bunch of timeout errors.

So i would like to know if anyone has some experiences with python3 pyramid async stuffs? which server do you recommend for both development and production case? 

Thanks.

Randall Leeds

unread,
Dec 24, 2014, 9:01:29 PM12/24/14
to pylons-...@googlegroups.com

I'm totally biased because I'm a gunicorn contributor, but I'll try to answer completely.

With python 3 you can use asyncio, but the framework has to support it. For that you could use https://github.com/mardiros/pyramid_asyncio

If you'd rather write your code in traditional style, I think the master branch of gevent may work on python 3 these days. Otherwise, eventlet definitely does.

Gunicorn makes it easy to use eventlet or gevent or asyncio. If you got timeout errors it may be because you didn't use the right worker that supports your asynchronous code. Gunicorn has a worker for gevent, eventlet, and asyncio.

uswgi is another popular server and I think it has gevent support, but again there is not a released version of gevent with Python 3 support but the master branch might.

Ask questions if any of that doesn't make sense and I'd be happy to clarify.

Mehdi

unread,
Dec 25, 2014, 5:24:30 AM12/25/14
to pylons-...@googlegroups.com
I use eventlet worker with gunicorn, but problem was that pyzmq is blocking process, i think. so i found this module of eventlet for pyzmq and all my problems solved! :)
For pyramid + asyncio i found aiopyramid more intersting. but still i have to try it more! actually i prefer to learn asyncio basics and manually make one or two views in my app async.
Thanks for your help. 
Reply all
Reply to author
Forward
0 new messages