Questions tagged [django-celery]

Django-celery provides Celery integration for Django.

Django-celery provides Celery integration for Django.

1738 questions
133
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
  • 48,559
  • 18
  • 128
  • 201
94
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
  • 43,201
  • 71
  • 221
  • 382
88
votes
3 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
  • 15,862
  • 27
  • 93
  • 146
81
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
  • 4,247
  • 7
  • 37
  • 49
69
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
  • 837
  • 1
  • 6
  • 8
67
votes
10 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
  • 22,772
  • 19
  • 94
  • 91
58
votes
14 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,507
  • 2
  • 22
  • 23
56
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): …
Thorin Schiffer
  • 2,818
  • 4
  • 25
  • 34
52
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
  • 42,059
  • 16
  • 116
  • 175
51
votes
2 answers

Celery unable to use redis

Trying to start Celery first time but issues error as below, i have installed redis and its starting fine , but still somehow django seems to have issues with it , File "", line 848, in exec_module File…
Atif Shafi
  • 954
  • 1
  • 11
  • 26
48
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
  • 5,539
  • 6
  • 32
  • 51
47
votes
8 answers

Celery auto reload on ANY changes

I could make celery reload itself automatically when there is changes on modules in CELERY_IMPORTS in settings.py. I tried to give mother modules to detect changes even on child modules but it did not detect changes in child modules. That make me…
Ahmet DAL
  • 4,445
  • 9
  • 47
  • 71
34
votes
5 answers

How to log exceptions occurring in a django celery task

I have set up celery to work with my django application using their daemonization instructions (http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#daemonizing) Here is my test task @periodic_task(run_every=timedelta(seconds=10)) def…
zimkies
  • 1,067
  • 1
  • 9
  • 20
31
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--
  • 6,427
  • 12
  • 54
  • 92
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,621
  • 14
  • 15
1
2 3
99 100