django-celery

Cannot start Celery Worker (Kombu.asynchronous.timer)

断了今生、忘了曾经 提交于 2019-12-05 07:21:45
I followed the first steps with Celery (Django) and trying to run a heavy process in the background. I have RabbitMQ server installed. However, when I try, celery -A my_app worker -l info it throws the following error File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>",

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

十年热恋 提交于 2019-12-05 06:14:08
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' if request.is_ajax(): if 'task_id' in request.POST.keys() and request.POST['task_id']: task_id =

can't import django model into celery task

眉间皱痕 提交于 2019-12-05 06:00:55
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. If I take out the entity import every thing is fine and no error occurs. When add back : from myapp

Django, RabbitMQ, & Celery - why does Celery run old versions of my tasks after I update my Django code in development?

别等时光非礼了梦想. 提交于 2019-12-05 02:08:35
So I have a Django app that occasionally sends a task to Celery for asynchronous execution. I've found that as I work on my code in development, the Django development server knows how to automatically detect when code has changed and then restart the server so I can see my changes. However, the RabbitMQ/Celery section of my app doesn't pick up on these sorts of changes in development. If I change code that will later be run in a Celery task, Celery will still keep running the old version of the code. The only way I can get it to pick up on the change is to: stop the Celery worker stop

MongoEngine and dealing with “UserWarning: MongoClient opened before fork. Create MongoClient with connect=False, or create client after forking”

≯℡__Kan透↙ 提交于 2019-12-05 01:02:10
问题 I am using Celery and MongoEngine as part of my Django App with. I am getting this warning, when a celery @shared_task accesses the mongodb database via mongoengine model classes: UserWarning: MongoClient opened before fork. Create MongoClient with connect=False,or create client after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#using-pymongo-with-multiprocessing It clearly has something to do with multiprocessing and pyMongo that is that

celeryev Queue in RabbitMQ Becomes Very Large

杀马特。学长 韩版系。学妹 提交于 2019-12-05 00:59:08
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 regularly, I think they are taking up quite a bit of disk space. You can use the CELERY_EVENT_QUEUE_TTL

Django Celery application - No module named celery error

随声附和 提交于 2019-12-04 20:44:13
问题 I have created a django-celery application as in the tutorial at: http://docs.celeryproject.org/en/master/django/first-steps-with-django.html Everything works fine when I run it without application parameter as in: $ python manage.py celery worker -l info but I can't start it at all with the application parameter, as in: $ python manage.py celery worker -A myapp -l info where myapp is the name given to the application when I created the project with: $ python manage.py startapp myapp The

Where is the data provided by django-celery urls stored? How long is the data available? And what is the memory consumption?

萝らか妹 提交于 2019-12-04 19:57:52
I am starting a project using django celery and I am making ajax calls to the task urls provided by 'djcelery.urls'. I would like to know a few things about this data: Where is that information being stored? Is it called from the djcelery tables in my django projects database or is it kept on the RabbitMQ server? My understanding of the djcelery tables in my database is that they are only for monitoring the usage using the camera. If it is being stored on the RabbitMQ server, how long will the tasks status report be available? How much memory does this data consume? Do I need to flush the task

Celery Task the difference between these two tasks below

一曲冷凌霜 提交于 2019-12-04 11:26:32
What's the difference between these two tasks below? The first one gives an error, the second one runs just fine. Both are the same, they accept extra arguments and they are both called in the same way. ProcessRequests.delay(batch) **error object.__new__() takes no parameters** SendMessage.delay(message.pk, self.pk) **works!!!!** Now, I have been made aware of what the error means, but my confusion is why one works and not the other. Tasks... 1) class ProcessRequests(Task): name = "Request to Process" max_retries = 1 default_retry_delay = 3 def run(self, batch): #do something 2) class

Consumer Connection error with django and celery+rabbitmq?

佐手、 提交于 2019-12-04 01:46:26
I'm trying to set up celeryd with django and rabbit-mq. So far, I've done the following: Installed celery from pip Installed rabbitmq via the debs available from their repository Added a user and vhost to rabbitmq via rabbitmqctl, as well as permissions for that user Started the rabbitmq-server Installed django-celery via pip Set up django-celery, including its tables Configured the various things in settings.py (BROKER_HOST, BROKER_PORT, BROKER_USER, BROKER_PASSWORD, BROKER_VHOST, as well as importing djecelery, calling the setup function and adding it to the INSTALLED APPS). I've double