celery

Django Celery send register email do not work

删除回忆录丶 提交于 2019-12-10 01:54:38
问题 I am learning Celery. In my website, I let people register an account. Once they create a new account, it will automatically send an activation email to their user email address. Everything works well but now I want to use Celery to send the email asynchronously. I use RabbitMQ as broker, version 3.1.5 and Celery 3.1.7 (the latest version), as they say this version does not need djcelery. So all I need is just to install Celery. I followed the instruction as celery its website, Configurate my

getting error Received unregistered task of type 'mytasks.add'

血红的双手。 提交于 2019-12-10 01:52:35
问题 I have written a file mytasks.py from celery import Celery celery = Celery("tasks", broker='redis://localhost:6379/0', backend='redis') @celery.task def add(x,y): return x+y and task.py as follow from mytasks import add add.delay(1,1) I have started redis server and I have started celery server. but when i m running task.py then i am getting the following error: Received unregistered task of type 'mytasks.add'. The message has been ignored and discarded. Did you remember to import the module

RabbitMQ/Celery/Django Memory Leak?

旧时模样 提交于 2019-12-10 01:23:48
问题 I recently took over another part of the project that my company is working on and have discovered what seems to be a memory leak in our RabbitMQ/Celery setup. Our system has 2Gb of memory, with roughly 1.8Gb free at any given time. We have multiple tasks that crunch large amounts of data and add them to our database. When these tasks run, they consume a rather large amount of memory, quickly plummeting our available memory to anywhere between 16Mb and 300Mb. The problem is, after these tasks

Incorrect user for supervisor'd celeryd

三世轮回 提交于 2019-12-09 16:59:32
问题 I have some periodic tasks that I run with celery (daemonized by supervisord), but after trying to create a directory in the home dir for the user i setup for the supervisor'd process I got a "permission denied" error. After looking at the os.environ dict in a running celery task I noticed that the USER var is set to 'root' and not the user that I set up in my supervisord config for celery. This is what my /usr/local/etc/supervisord.conf looks like: [unix_http_server] file=/tmp/supervisor

Celery dynamic queue creation and routing

跟風遠走 提交于 2019-12-09 16:45:17
问题 I'm trying to call a task and create a queue for that task if it doesn't exist then immediately insert to that queue the called task. I have the following code: @task def greet(name): return "Hello %s!" % name def run(): result = greet.delay(args=['marc'], queue='greet.1', routing_key='greet.1') print result.ready() then I have a custom router: class MyRouter(object): def route_for_task(self, task, args=None, kwargs=None): if task == 'tasks.greet': return {'queue': kwargs['queue'], 'exchange'

Python - celery 相关报错 - AttributeError: type object '_multiprocessing.win32' has no attribute 'WAIT_OBJECT_0'

本秂侑毒 提交于 2019-12-09 16:35:02
报错场景 执行 celery worker -A tasks -l INFO 打开 worker 的时候报错无法进行 报错解决 Celery 的版本过高, 进行降级处理即可 pip install celery==3.1.25 降级后再次执行会触发 另一报错 此报错原因是 redis 的版本过高导致 对 redis 进行降级即可 pip install redis==2.10.6 来源: https://www.cnblogs.com/shijieli/p/12011756.html

Python - Celery

旧巷老猫 提交于 2019-12-09 15:42:54
Celery 概念 简单的灵活可靠的处理大量消息的分布式系统 专注于实时处理的异步任务队列, 同时也支持任务调度 结构图 使用场景 异步任务   将耗时的操作任务提交给 Celery 去异步执行 - 比如发送短信 / 邮件, 消息推送, 音视频处理等 定时任务   类似于 crontab, 比如每日的数据统计 安装 pip install celery[redis] 消息中间件 - 可选 [RabbitMQ / Redis] 来源: https://www.cnblogs.com/shijieli/p/12011211.html

Celery CRITICAL/MainProcess] Unrecoverable error: AttributeError(“'float' object has no attribute 'items'”,)

耗尽温柔 提交于 2019-12-09 14:48:19
问题 I've been running a flask application with a celery worker and redis in three separated docker containers without any issue. This is how I start it: celery worker -A app.controller.engine.celery -l info --concurrency=2 --pool eventlet Celery starts fine: -------------- celery@a828bd5b0089 v4.2.1 (windowlicker) ---- **** ----- --- * *** * -- Linux-4.9.93-linuxkit-aufs-x86_64-with 2018-11-15 16:06:59 -- * - **** --- - ** ---------- [config] - ** ---------- .> app: app.controller.engine

Celery in daemon mode

我怕爱的太早我们不能终老 提交于 2019-12-09 13:23:18
问题 I use GNU screen for running Celery in console mode, but it's a hack I don't want to use on prodution server. I want to know how to daemonize Celery. I have virtualenv with celery set up. I want to run %venv%/bin/celeryd in daemon mode. I tried ./celeryd start and got: Unrecognized command line arguments: start What else I should try to run it in daemon mode? 回答1: Try this /etc/init.d/celeryd script. #!/bin/sh -e ### BEGIN INIT INFO # Provides: celeryd # Required-Start: $network $local_fs

Task priority in celery with redis

落爺英雄遲暮 提交于 2019-12-09 11:54:27
问题 I would like to implement a distributed job execution system with celery. Given that rabbitMQ doesn't support priorities and I'm painfully needing this feature, I turned to celery+redis. In my situation, the tasks are closely related to hardware, for example, task A could only run on Worker 1 since only the PC of Worker 1 has got the necessary hardware. I set the CONCURRENCY of each worker to 1 so that a worker will only run one task each time. Each task takes about 2 minites. To implement