[CentralOH] Django + Celery + RabbitMQ
coding.solo
coding.solo at gmail.com
Wed Jul 20 14:51:38 CEST 2011
Hi all, I hope you guys can help me on this:
I have a developing a Django app that processes many <reallyLongTask>. My
current implementation to get everything up and running was to block for
<reallyLongTask> and then deliver the results in a view. That works great,
but was really long. Now I want to take it 2.0 with the auspicious notion
of asynchronous back-end processing whilst polling with AJAX on the
front-end to populate the results as they are ready. Currently, a
<reallyLongTask> returns a list of lists. Instead of returning a list of
lists, I want to factor out the enveloping list and just want to return
lists.
Now begins my questions. I have Celery successfully working with
RabbitMQ. In my Django view, I execute my <reallyLongTask>.delay() and
catch its AsyncResult. I get the AsyncResult.task_id over to the front-end
browser so that it can poll this task.
1) In my AJAX Django view, how am I supposed to query the task with only
this task_id?
2) Since my original view no longer returns a list of lists, what do you
guys suggest I do to pass my *lists* back to the browser front-end when each
individual one is ready? I would suspect RabbitMQ could handle such an
exchange somehow, possibly even Celery. I am thinking I want to populate a
list for the AJAX view to draw from when the front-end polls that view.
Thanks all! Can't wait for my first PyOhio!
Brandon Lorenz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/centraloh/attachments/20110720/30c3548b/attachment.html>
More information about the CentralOH
mailing list