djcelery

Django: djcelery Import error from celery import current_app as celery in virtualenv

青春壹個敷衍的年華 提交于 2020-01-14 14:12:05
问题 Okay so I have tried everything I and google can come up. I'm trying to run django-celery under a virtualenv on my Macbook Pro OSX 10.8.4. I installed django-celery using pip while the virtualenv was activated. I get the following when importing djcelery in virtualenv python. (platform)Chriss-MacBook-Pro:platform Chris$ python Python 2.7.2 (default, Oct 11 2012, 20:14:37) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type "help", "copyright", "credits" or

django 2.1 celery not execute asyncron task

早过忘川 提交于 2019-12-24 23:32:22
问题 i try to execute background function using celery: this is my current code : from VideoPublish.models import TitleVideo, Videos from celery.decorators import task from UploadExpert.celery import app # Create your views here. demo_titles =['title1', 'title2', 'title3'] @app.task(ignore_result=True) def GetTitles(video_id): video = Videos.objects.get(pk=video_id) for title in demo_titles: t = TitleVideo( title=title, video_id=video.id ) t.save() this is call function : GetTitles.delay(video_id

Django celery running only two tasks at once?

℡╲_俬逩灬. 提交于 2019-12-24 05:32:20
问题 I have a celery task like this: @celery.task def file_transfer(password, source12, destination): result = subprocess.Popen(['sshpass', '-p', password, 'rsync', '-avz', source12, destination], stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0] return result I have called in a Djagno view. User can select more than one file to copy to the destination. For example if the user selects, 4 files at once, celery accept only 2 tasks. What's wrong? 回答1: Have you checked the concurrency

Django celery running only two tasks at once?

本小妞迷上赌 提交于 2019-12-24 05:32:13
问题 I have a celery task like this: @celery.task def file_transfer(password, source12, destination): result = subprocess.Popen(['sshpass', '-p', password, 'rsync', '-avz', source12, destination], stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0] return result I have called in a Djagno view. User can select more than one file to copy to the destination. For example if the user selects, 4 files at once, celery accept only 2 tasks. What's wrong? 回答1: Have you checked the concurrency

Unable to connect to celery task from a celery signal?

被刻印的时光 ゝ 提交于 2019-12-24 02:33:25
问题 I am trying to connect task2 from task_success signal from celery.signals import task_success from celery import Celery app = Celery() @app.task def task1(): return 't1' @app.task def task2(): return 't2' task_success.connect(task2, sender=task1) When I run this code, its throwing TypeError: cannot create weak reference to 'PromiseProxy' object If remove app.task decorator for task2, it works perfectly. But why is it unable to connect to celery task? 回答1: The technical details is that the

Django celery beat pytz error on startup

纵然是瞬间 提交于 2019-12-11 13:52:37
问题 Out of the blue I get the following error when trying to start my dev server with celery and celery beat. One day this thing works next day it doesn't, I haven't changed anything that could explain this. I start my server using foreman and a Procfile.dev like so: Procfile: web: python manage.py runserver celeryd: python manage.py celeryd -E -B --loglevel=INFO --concurrency=3 worker: python manage.py celerycam Command: foreman start -f Procfile.dev Like I said this never gave any errors.

djcelery入门:实现运行定时任务

百般思念 提交于 2019-12-03 16:26:13
基于Django与Celery实现异步对列任务 - Python - 伯乐在线 http://python.jobbole.com/81953/ 更新于2015-08-26 注:本文根据官方文档结合具体例子整理,供celery入门学习,更多内容请移步参考资料一节。最近更新于2014-10-19 1 什么是celery celery是一个异步任务队列/基于分布式消息传递的作业队列。Celery通过消息(message)进行通信,使用代理(broker)在客户端和工作执行者之间进行交互。当开始一个任务时,客户端发送消息到队列并由代理将其发往响应的工作执行者处。 2 Windows环境配置 在这里使用RabbitMQ作为消息代理(broker),Django数据库作为结果存储(ResultStore)。 2.1 安装ERLang 首先是到ERLang官网去下载ERlang可执行文件 地址: http://www.erlang.org/download.html 然后安装ERLang。 然后设置ERLang的环境变量。 在环境变量中加入 ERL_HOME = erlang安装目录 在path中添加 %ERL_HOME%\bin 2.2 安装rabbitmq 从 http://www.rabbitmq.com/releases/rabbitmq-server/v3.1.5/rabbitmq

How to properly configure djcelery results backend to database

a 夏天 提交于 2019-12-03 07:04:40
问题 I'm trying to setup djangocelery to store task results in the databse. I set: CELERY_RESULT_BACKEND = 'djcelery.backends.database.DatabaseBackend' then I synced and migrated the db (no errors). Celery is working and tasks get processed (I can get the results), but admin shows there is no tasks. In the database are two tables celery_taskmeta and djcelery_taskmeta . First one is holding the results and second one is displayed in admin. Anyone has insight how to configure it properly? 回答1: Check

How to properly configure djcelery results backend to database

随声附和 提交于 2019-12-02 19:37:30
I'm trying to setup djangocelery to store task results in the databse. I set: CELERY_RESULT_BACKEND = 'djcelery.backends.database.DatabaseBackend' then I synced and migrated the db (no errors). Celery is working and tasks get processed (I can get the results), but admin shows there is no tasks. In the database are two tables celery_taskmeta and djcelery_taskmeta . First one is holding the results and second one is displayed in admin. Anyone has insight how to configure it properly? Check the doc , when you use djcelery, set CELERY_RESULT_BACKEND="database" or don't even bother to write this

Python Celery - How to call celery tasks inside other task

混江龙づ霸主 提交于 2019-11-30 10:08:13
I'm calling a task within a tasks in Django-Celery Here are my tasks. @shared_task def post_notification(data,url): url = "http://posttestserver.com/data/?dir=praful" # when in production, remove this line. headers = {'content-type': 'application/json'} requests.post(url, data=json.dumps(data), headers=headers) @shared_task def shipment_server(data,notification_type): notification_obj = Notification.objects.get(name = notification_type) server_list = ServerNotificationMapping.objects.filter(notification_name=notification_obj) for server in server_list: task = post_notification.delay(data