django-celery

Retrieve queue length with Celery (RabbitMQ, Django)

为君一笑 提交于 2019-12-08 15:55:42
问题 I'm using Celery in a django project, my broker is RabbitMQ, and I want to retrieve the length of the queues. I went through the code of Celery but did not find the tool to do that. I found this issue on stackoverflow (Check RabbitMQ queue size from client), but I don't find it satisfying. Everything is setup in celery, so there should be some kind of magic method to retrieve what I want, without specifying a channel / connection. Does anyone have any idea about this question ? Thanks ! 回答1:

django/celery - celery status: Error: No nodes replied within time constraint

回眸只為那壹抹淺笑 提交于 2019-12-08 15:41:33
问题 I'm trying to deploy a simple example of celery in my production server, I've followed the tutorial in the celery website about running celery as daemon http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#daemonizing, and I got the config file in /etc/default/celeryd 1 # Name of nodes to start 2 # here we have a single node 3 CELERYD_NODES="w1" 4 # or we could have three nodes: 5 #CELERYD_NODES="w1 w2 w3" 6 7 # Where to chdir at start. 8 CELERYD_CHDIR="/home/audiwime/cidec_sw"

Celery beat - different time zone per task

我们两清 提交于 2019-12-08 01:46:49
问题 I am using celery beat to schedule some tasks. I'm able to use the CELERY_TIMEZONE setting to schedule the tasks using the crontab schedule and it runs at the scheduled time in the mentioned time zone. But I want to be able to setup multiple such tasks for different timezones in the same application (single django settings.py). I know which task needs to run in what timezone when the task is being scheduled. Is it possible to specify a different timezone for each of the tasks? I'm using

Django Celery Scheduling a manage.py command

雨燕双飞 提交于 2019-12-07 16:18:35
问题 I need to update the solr index on a schedule with the command: (env)$ ./manage.py update_index I've looked through the Celery docs and found info on scheduling, but haven't been able to find a way to run a django management command on a schedule and inside a virtualenv. Would this be better run on a normal cron? And if so how would I run it inside the virtualenv? Anyone have experience with this? Thanks for the help! 回答1: To run your command periodically from a cron job, just wrap the

Celery / RabbitMQ - Find out the No Acks - Unacknowledged messages

本秂侑毒 提交于 2019-12-07 12:24:30
问题 I am trying to figure out how to get information on unacknowledged messages. Where are these stored? In playing with celery inspect it seems that once a message gets acknowledged it processes through and you can follow the state. Assuming you have a results backend then you can see the results of it. But from the time you apply delay until it get's acknowledged it's in a black hole. Where are noAcks stored? How do I find out how "deep" is the noAcks list? In other words how many are there and

Prevent Celery Beat from running the same task

狂风中的少年 提交于 2019-12-07 09:30:34
问题 I have a scheduled celery running tasks every 30 seconds. I have one that runs as task daily, and another one that runs weekly on a user specified time and day of the week. It checks for the "start time" and the "next scheduled date". The next scheduled date does not update until the task is completed. However, I want to know how to make sure that the celery beat is only running the task once. I see that right now, celery will run a certain task multiple times until that task's next scheduled

How do I permanently remove a celery task from rabbitMQ?

眉间皱痕 提交于 2019-12-07 04:26:06
问题 I have around 10,000 scheduled tasks on my current celery setup. I didn't realize what scheduled tasks were and decided to use them to send follow-up emails months in advance. Looking back, it's probably never a good idea to schedule a task for more than 1 hour in the future as every time you restart a worker it has to re-receive every scheduled task from rabbitMQ and then they all just sit in the memory. My problem is that if I have to revoke a task, it doesn't just delete it. The task stays

can't import django model into celery task

天大地大妈咪最大 提交于 2019-12-07 03:40:00
问题 i have the following task: from __future__ import absolute_import from myproject.celery import app from myapp.models import Entity @app.task def add(entity_id): entity = Entity.objects.get(pk=entity_id) return entity.name I get the following error: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

AsyncResult(task_id) returns “PENDING” state even after the task started

三世轮回 提交于 2019-12-07 03:22:46
问题 In the project, I try to poll task.state of a long running task and update its running status. It worked in the development, but it won't work when I move the project on production server. I kept getting 'PENDING' even I can see the task started on flower. However, I can still get the results updated when the task finished, which when task.state == 'SUCCESS'. I use python 2.6, Django 1.6 and Celery 3.1 in the production, result backend AMQP. @csrf_exempt def poll_state(request): data = 'Fail'

celeryev Queue in RabbitMQ Becomes Very Large

房东的猫 提交于 2019-12-06 17:52:50
问题 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 (hundreds of thousands of items in the queue). The queues are named celeryev.[...] (see screenshot below). Is this appropriate behavior? What is the purpose of these queues and shouldn't they be regularly purged? Is there a way to purge them more