django-celery

Class based Task in django celery

巧了我就是萌 提交于 2020-01-07 02:56:05
问题 I am using this class to push notification via celery. The class definition goes like this. from celery import Task class NotifyUser(Task): """ send push notification, entry point for this purpose is def send_notification() """ def __init__(self, users=None, notification_code=None, context=None, merchant_flag=False, listing_flag=False, object_type=None, object_id=None, category_id=None, *args, **kwargs): Task.__init__(self, *args, **kwargs) self.notification_code = notification_code self

Celery Async Tasks and Periodic Tasks together

你离开我真会死。 提交于 2020-01-05 07:01:08
问题 Unable to run periodic tasks along with asynchronous tasks together. Although, if I comment out the periodic task, asynchronous tasks are executed fine, else asynchronous tasks are stuck. Running: celery==4.0.2, Django==2.0, django-celery-beat==1.1.0, django-celery-results==1.0.1 Referred: https://github.com/celery/celery/issues/4184 to choose celery==4.0.2 version, as it seems to work. Seems to be a known issue https://github.com/celery/django-celery-beat/issues/27 I've also done some

Getting latest tasks from Celery and display them using Django

余生颓废 提交于 2020-01-05 07:00:43
问题 I have a Django 1.5.1 webapp using Celery 3.0.23 with RabbitMQ 3.1.5. and sqlite3. I can submit jobs using a simple result = status.tasks.mymethod.delay(parameter) , all tasks executes correctly: [2013-09-30 17:04:11,369: INFO/MainProcess] Got task from broker: status.tasks.prova[a22bf0b9-0d5b-4ce5-967a-750f679f40be] [2013-09-30 17:04:11,566: INFO/MainProcess] Task status.tasks.mymethod[a22bf0b9-0d5b-4ce5-967a-750f679f40be] succeeded in 0.194540023804s: u'Done' I want to display in a page the

celeryd and celerybeat pid files are not being created, workers are not starting, but output says OK

只谈情不闲聊 提交于 2020-01-04 02:20:17
问题 I setted up celeryd and celerybeat as daemons, and they worked until not too long. But since some time, it wont start workers and not create pid files. Here is my /etc/default/celeryd : # Name of nodes to start CELERYD_NODES="w1 w2 w3 w4 w5 w6 w7 w8" # Extra arguments to celeryd CELERYD_OPTS="--time-limit=300 --concurrency=8" # Where to chdir at start. CELERYD_CHDIR="/srv/www/web-system/myproject" # %n will be replaced with the nodename. #CELERYD_LOG_FILE="/var/log/celery/%n.log" #CELERYD_PID

Celery immediately exceeds memory on Heroku

南楼画角 提交于 2020-01-04 01:33:09
问题 I'm deploying a Celery process to Heroku and every time it starts, it immediately starts to rack up memory usage and crash after it exceeds the maximum. I only have one task called "test_task" that prints once per minute. This is Django app using Celery with a Redis backend hosted on Heroku. Proc file: web: daphne chatbot.asgi:channel_layer --port $PORT --bind 0.0.0.0 --verbosity 1 chatworker: python manage.py runworker --verbosity 1 celeryworker: celery -A chatbot worker -l info Heroku logs:

Running celeryd_multi with supervisor

我是研究僧i 提交于 2019-12-30 08:30:14
问题 I'm working with djcelery and supervisor. I was running a celery with supervisor and everything worked fine, once I realized that I needed to change it to celery multi everything broke up. If I run celeryd_multi in a terminal it works but always run in background, like supervisor need that the command run in foreground there where the problem is. This is my celery.ini : [program:celery_{{ division }}] command = {{ virtualenv_bin_dir }}/python manage.py celeryd_multi start default mailchimp -c

Why are celery_taskmeta and other tables not being created when running a syncdb in django?

天涯浪子 提交于 2019-12-30 02:11:49
问题 I'm trying to setup celery and django, but the celery_taskmeta table is not being created. I've followed numerous (Recent) tutorials, added djcelery and djkombu to my installed_apps. added the 'BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport"' line to my settings, etc. I can run the daemon just fine, and it will execute tasks, but it spits out this traceback at the end: ============== 2011-08-05 16:21:16,231: ERROR/MainProcess] Task slate.modules.filebrowser.tasks.gen_thumb_task

celery task and customize decorator

拟墨画扇 提交于 2019-12-28 05:51:46
问题 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 and perform tasks with celery(so we don't have django ORM dependency in this layer). In my manager.py , I have something like this: def get_tag(tag_name): ctype = ContentType.objects.get_for_model(Photo) try: tag = Tag.objects.get(name=tag_name)

Accessing `http://localhost:8080/admin/djcelery/` returns 403 in Django

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 14:28:55
问题 I am trying to access http://localhost:8080/admin/djcelery/ in my Django admin. I can access http://localhost:8080/admin , I can run celery task but I can't access the djcelery admin site. Here is my url url(r'^admin/', include(admin.site.urls)), Here is settings.py import djcelery djcelery.setup_loader() BROKER_URL = "amqp://guest:guest@localhost:5672//" CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend' CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler' Do I have

How can I get rid of legacy tasks still in the Celery / RabbitMQ queue?

醉酒当歌 提交于 2019-12-24 08:26:09
问题 I am running Django + Celery + RabbitMQ. After modifying some task names I started getting "unregistered task" KeyErrors, even after removing tasks with this key from the Periodic tasks table in Django Celery Beat and restarting the Celery worker. They persist even after running with the --purge option. How can I get rid of them? 回答1: To flush out the last of these tasks, you can re-implement them with their old method headers, but no logic. For example, if you removed the method original and