Questions tagged [django-celery]

Django-celery provides Celery integration for Django.

Django-celery provides Celery integration for Django.

1525 questions
19
votes
3 answers

Celery task state always pending

I am pretty new to celery and django in general so please excuse my lack of knowledge. I am trying to run a test to do some calculations and wait for the test to finish so that I can make sure it is done for the correct answers. Here is what i…
DoctorWizard
  • 273
  • 1
  • 3
  • 11
18
votes
3 answers

How to tell if a task has already been queued in django-celery?

Here's my setup: django 1.3 celery 2.2.6 django-celery 2.2.4 djkombu 0.9.2 In my settings.py file I have BROKER_BACKEND = "djkombu.transport.DatabaseTransport" i.e. I'm just using the database to queue tasks. Now on to my problem: I have a…
cwick
  • 24,336
  • 12
  • 35
  • 40
18
votes
1 answer

Retry Lost or Failed Tasks (Celery, Django and RabbitMQ)

Is there a way to determine if any task is lost and retry it? I think that the reason for lost can be dispatcher bug or worker thread crash. I was planning to retry them but I'm not sure how to determine which tasks need to be retired? And how…
Julian Popov
  • 16,951
  • 11
  • 48
  • 79
18
votes
5 answers

Stopping Supervisor doesn't stop Celery workers

How do I ensure sub-processes are stopped when I stop Supervisord? I'm using Supervisord to run two Celery workers. The command for each worker is: command=/usr/local/myapp/src/manage.py celery worker --concurrency=1 --loglevel=INFO When I start…
Cerin
  • 50,711
  • 81
  • 269
  • 459
18
votes
3 answers

How can I defer the execution of Celery tasks?

I have a small script that enqueues tasks for processing. This script makes a whole lot of database queries to get the items that should be enqueued. The issue I'm facing is that the celery workers begin picking up the tasks as soon as it is…
Mridang Agarwalla
  • 38,521
  • 65
  • 199
  • 353
18
votes
2 answers

Retrying celery failed tasks that are part of a chain

I have a celery chain that runs some tasks. Each of the tasks can fail and be retried. Please see below for a quick example: from celery import task @task(ignore_result=True) def add(x, y, fail=True): try: if fail: raise…
Andrei
  • 209
  • 2
  • 8
17
votes
2 answers

Celery: Worker with concurrency and reserved tasks only running 1 task

Some of the tasks in my code were taking longer and longer to execute. Upon inspection I noticed that although I have my worker node set to concurrency 6, and 6 processes exist to 'do work', but only 1 task is shown under 'running tasks'. Here is a…
steve-gregory
  • 7,036
  • 7
  • 34
  • 47
17
votes
5 answers

celeryev Queue in RabbitMQ Becomes Very Large

I am using celery on rabbitmq. I have been sending thousands of messages to the queue and they are being processed successfully and everything is working just fine. However, the number of messages in several rabbitmq queues are growing quite large…
speedplane
  • 14,130
  • 14
  • 78
  • 128
16
votes
6 answers

django-celery: No result backend configured

I am trying to use django-celery in my project In settings.py I have CELERY_RESULT_BACKEND = "amqp" The server started fine with python manage.py celeryd --setting=settings But if I want to access a result from a delayed task, I get the following…
airfang
  • 1,138
  • 2
  • 13
  • 22
16
votes
2 answers

celery task and customize decorator

I'm working on a project using django and celery(django-celery). Our team decided to wrap all data access code within (app-name)/manager.py(NOT wrap into Managers like the django way), and let code in (app-name)/task.py only dealing with assemble…
zxygentoo
  • 213
  • 1
  • 2
  • 6
16
votes
5 answers

Django: How to automatically change a field's value at the time mentioned in the same object?

I am working on a django project for racing event in which a table in the database has three fields. 1)Boolean field to know whether race is active or not 2)Race start time 3)Race end time While creating an object of it,the start_time and end_time…
cold_coder
  • 444
  • 3
  • 8
  • 23
16
votes
2 answers

Celerybeat not executing periodic tasks

How do you diagnose why manage.py celerybeat won't execute any tasks? I'm running celerybeat via supervisord with the command: /usr/local/myapp/src/manage.py celerybeat --schedule=/tmp/celerybeat-schedule-myapp --pidfile=/tmp/celerybeat-myapp.pid…
Cerin
  • 50,711
  • 81
  • 269
  • 459
16
votes
3 answers

Django celery task: Newly created model DoesNotExist

Why is a model instance I've created, when queried from a celery task started directly afterwards, not found? For example: # app.views model = Model.objects.create() # I create my lovely model in a view from app.tasks import ModelTask # I…
Marcus Whybrow
  • 18,372
  • 7
  • 64
  • 88
15
votes
3 answers

How to route tasks to different queues with Celery and Django

I am using the following stack: Python 3.6 Celery v4.2.1 (Broker: RabbitMQ v3.6.0) Django v2.0.4. According Celery's documentation, running scheduled tasks on different queues should be as easy as defining the corresponding queues for the tasks on…
Ander
  • 3,706
  • 4
  • 27
  • 49
15
votes
4 answers

Celery - No module named five

After updating celery and django-celery to 3.1: $ pip freeze | grep celery celery==3.1.18 django-celery==3.1.16 I run into this error when starting my server: Traceback (most recent call last): File "app/manage.py", line 16, in
laffuste
  • 13,488
  • 6
  • 71
  • 83