Having problem calling @task from wsgi.Router function

18 views
Skip to first unread message

Mario McGinley

unread,
Nov 13, 2015, 2:27:47 PM11/13/15
to python-pulsar
Hello,
It seems I can not execute a @task with asyncio.as_completed from a wsgi.Router function.  I set the WsgiHandler async=True flag and tried @asyncio.coroutine over the wsgi.Router function, still producing errors when calling the @task from asyncio.as_completed.
Thanks in advance,
-Mario

lsbardel

unread,
Nov 15, 2015, 10:30:12 AM11/15/15
to python-pulsar
You cannot return a coroutine from a wsgi handler.
You need to wrap your handler in a task, you can use the @pulsar.task decorator for it.

In python 3.5 it will be possible via the async keyword since we can distinguish between native coroutines and generators.

 
Reply all
Reply to author
Forward
0 new messages