On Tue, Mar 20, 2012 at 9:52 AM, Arruda <felipe.arruda.pon...@gmail.com> wrote:
> But I still wanted to know how to use the celery in this case =/

the idea is to use a Queue:

you have a separate process (typically implemented in a manage
command) that stays running, and waits for messages in the queue.

when the web app wants to do some slow processing, writes any needed
parameters to the queue and returns with a 'wait...' message

the background process receives the queue item and does the process
without tying up the web response.


the first implementation almost everybody does is called "Ghetto
queues", it consist of writing the parameters to the database in a
'todo' table, and a cron process that periodically checks these todo's
and processes them.  it works, but falls down at a certain load.
after that, you need a real queue manager; either RabbitMQ, Redis
Queues, or a lot of other options.

Celery is a python package that allows you to simply add a '@task'
decorator to any function; so that when you call them, they're not
executed, but instead the argument list is pushed to a queue.  it also
creates an admin command that does the queue reading and actually
calls the functions with the arguments it founds on there.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to