Questions tagged [django-celery]

Django-celery provides Celery integration for Django.

Django-celery provides Celery integration for Django.

1525 questions
103
votes
13 answers

How to check task status in Celery?

How does one check whether a task is running in celery (specifically, I'm using celery-django)? I've read the documentation, and I've googled, but I can't see a call like: my_example_task.state() == RUNNING My use-case is that I have an external…
Marcin
  • 44,601
  • 17
  • 110
  • 191
81
votes
3 answers

How can I run a celery periodic task from the shell manually?

I'm using celery and django-celery. I have defined a periodic task that I'd like to test. Is it possible to run the periodic task from the shell manually so that I view the console output?
Mridang Agarwalla
  • 38,521
  • 65
  • 199
  • 353
77
votes
2 answers

Retry Celery tasks with exponential back off

For a task like this: from celery.decorators import task @task() def add(x, y): if not x or not y: raise Exception("test error") return self.wait_until_server_responds( if it throws an exception and I want to retry it from the…
Quintin Par
  • 14,646
  • 27
  • 87
  • 142
70
votes
4 answers

Django Celery Logging Best Practice

I'm trying to get Celery logging working with Django. I have logging set-up in settings.py to go to console (that works fine as I'm hosting on Heroku). At the top of each module, I have: import logging logger = logging.getLogger(__name__) And in my…
alan
  • 3,717
  • 6
  • 31
  • 48
57
votes
13 answers

rabbitmq-server fails to start after hostname has changed for first time

I am using django-celery for my django project. Last day I have changed my computer's hostname (I am using Ubuntu 12.04, edited file '/etc/hostname'), and after next restart django-celery was failing with error Consumer: Connection Error: [Errno…
Jinesh
  • 2,367
  • 2
  • 19
  • 21
55
votes
7 answers

Detect whether Celery is Available/Running

I'm using Celery to manage asynchronous tasks. Occasionally, however, the celery process goes down which causes none of the tasks to get executed. I would like to be able to check the status of celery and make sure everything is working fine, and if…
Cory
  • 18,463
  • 16
  • 85
  • 82
48
votes
5 answers

using class methods as celery tasks

I'm trying to use the methods of class as the django-celery tasks, marking it up using @task decorator. The same situation is discribed here, asked by Anand Jeyahar. It's something like this class A: @task def foo(self, bar): …
eviltnan
  • 2,612
  • 2
  • 22
  • 34
45
votes
2 answers

Why would running scheduled tasks with Celery be preferable over crontab?

Considering Celery is already a part of the stack to run task queues (i.e. it is not being added just for running crons, that seems an overkill IMHO ). How can its "periodic tasks" feature be beneficial as a replacement for crontab ? Specifically…
DhruvPathak
  • 38,316
  • 14
  • 103
  • 164
39
votes
3 answers

How to send periodic tasks to specific queue in Celery

By default Celery send all tasks to 'celery' queue, but you can change this behavior by adding extra parameter: @task(queue='celery_periodic') def recalc_last_hour(): log.debug('sending new task') recalc_hour.delay(datetime(2013, 1, 1, 2))…
Artem Mezhenin
  • 4,933
  • 5
  • 27
  • 46
30
votes
1 answer

Why doesn't CeleryCAM work with Amazon SQS?

I'm using Celery 2.4.6 and django-celery 2.4.2. When I configure Celery to use Amazon SQS per the resolution on this question: Celery with Amazon SQS I don't see anything in the celerycam table in the Django admin. If I switch back to RabbitMQ, the…
tobias.mcnulty
  • 1,510
  • 13
  • 14
28
votes
1 answer

Examples of Django and Celery: Periodic Tasks

I have been fighting the Django/Celery documentation for a while now and need some help. I would like to be able to run Periodic Tasks using django-celery. I have seen around the internet (and the documentation) several different formats and schemas…
Jonathan May
  • 421
  • 1
  • 5
  • 9
28
votes
1 answer

Difference between different ways to create celery task

I am very confused by looking at different ways of creating a celery task. On the surface they all work the same So, Can someone explain what is the difference between these. 1. from myproject.tasks import app @app.task def foo(): pass 2. from…
MOntu
  • 369
  • 3
  • 7
27
votes
2 answers

Django Celery: Admin interface showing zero tasks/workers

I've setup Celery with Django ORM as back-end. Trying to monitor what's going on behind the scene. I've started celeryd with -E flag python manage.py celeryd -E -l INFO -v 1 -f /path/to/celeryd.log Started celerycam with default snapshot frequency…
rubayeet
  • 8,598
  • 6
  • 41
  • 54
26
votes
4 answers

Django and Celery - re-loading code into Celery after a change

If I make a change to tasks.py while celery is running, is there a mechanism by which it can re-load the updated code? or do I have to shut Celery down a re-load? I read celery had an --autoreload argument in older versions, but I can't find it in…
JasonGenX
  • 5,412
  • 23
  • 86
  • 164
26
votes
2 answers

celery - chaining groups and subtasks. -> out of order execution

When I have something like the following group1 = group(task1.si(), task1.si(), task1.si()) group2 = group(task2.si(), task2.si(), task2.si()) workflow = chain(group1, group2, task3.si()) The intuitive interpretation is that task3 should only…
w--
  • 5,395
  • 9
  • 49
  • 88
1
2 3
99 100