4

I am trying to run task with Celery. I follow this tutorials link

Everything has been setup successfully. The thing now is that I don't know how to execute a task. I run celeryd and it couldn't find the task. I want to know what exactly I need to call to execute the task and how I need to config the task on RabbitMQ server, django-admin.. I cannot find any full tutorials about it.

Le Duy Khanh
  • 1,339
  • 3
  • 17
  • 36

3 Answers3

4

Django by example has a full section on using Celery with RabbitMQ. There are also free tutorials or articles on this topic

doru
  • 9,022
  • 2
  • 33
  • 43
2

task definition app/tasks.py:

from celery import shared_task

@shared_task
def add(param1,param2)
  print("task")

task execution:

from celery import current_app
current_app.send_task("app.tasks.add", ["param1", "param2"])
Meska
  • 181
  • 1
  • 6
0

This might help you to get an idea how to run Celery.

It worked fine for me.

http://www.hiddentao.com/archives/2012/01/27/processing-long-running-django-tasks-using-celery-rabbitmq-supervisord-monit/

chandu
  • 1,053
  • 9
  • 18