celery

celery stuck at mingle: searching for neighbors, doesn't get to ready state

微笑、不失礼 提交于 2020-02-20 07:56:03
问题 I had run celery for my project using 10 threads. It worked perfectly. Now, when i use the command: celery -A tasks worker --loglevel=info --concurrency 10 celery get stuck at : [2014-08-07 12:55:21,013: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672// [2014-08-07 12:55:21,025: INFO/MainProcess] mingle: searching for neighbors earlier it showed ready state after this. and when i try to end this using ctrl+c , it doesn't shutdown. [2014-08-07 12:55:21,013: INFO/MainProcess]

Keras predict not returning inside celery task

邮差的信 提交于 2020-02-19 03:24:32
问题 Following Keras function (predict) works when called synchronously pred = model.predict(x) But it does not work when called from within an asynchronous task queue (Celery). Keras predict function does not return any output when called asynchronously. The stack is: Django, Celery, Redis, Keras, TensorFlow 回答1: I ran into this exact same issue, and man was it a rabbit hole. Wanted to post my solution here since it might save somebody a day of work: TensorFlow Thread-Specific Data Structures In

Keras predict not returning inside celery task

帅比萌擦擦* 提交于 2020-02-19 03:23:32
问题 Following Keras function (predict) works when called synchronously pred = model.predict(x) But it does not work when called from within an asynchronous task queue (Celery). Keras predict function does not return any output when called asynchronously. The stack is: Django, Celery, Redis, Keras, TensorFlow 回答1: I ran into this exact same issue, and man was it a rabbit hole. Wanted to post my solution here since it might save somebody a day of work: TensorFlow Thread-Specific Data Structures In

Celery tasks received but not executing

北城以北 提交于 2020-02-18 04:59:28
问题 I have Celery tasks that are received but will not execute. I am using Python 2.7 and Celery 4.0.2. My message broker is Amazon SQS. This the output of celery worker : $ celery worker -A myapp.celeryapp --loglevel=INFO [tasks] . myapp.tasks.trigger_build [2017-01-12 23:34:25,206: INFO/MainProcess] Connected to sqs://13245:**@localhost// [2017-01-12 23:34:25,391: INFO/MainProcess] celery@ip-111-11-11-11 ready. [2017-01-12 23:34:27,700: INFO/MainProcess] Received task: myapp.tasks.trigger_build

Celery Beat定时任务

▼魔方 西西 提交于 2020-02-15 23:56:07
示例代码 创建schedule_tasks.py文件 from celery import Celery from celery.schedules import crontab app = Celery("SchedulerTasks", broker='pyamqp://admin:admin@172.16.37.200:5672//') @app.on_after_configure.connect def setup_periodic_tasks(sender, **kwargs): # Calls test('hello') every 10 seconds. sender.add_periodic_task(10.0, test.s('hello'), name='add every 10') # Calls test('world') every 30 seconds sender.add_periodic_task(30.0, test.s('world'), expires=10) # Executes every Monday morning at 7:30 a.m. sender.add_periodic_task( crontab(hour=7, minute=30, day_of_week=1), test.s('Happy Mondays!'), )

HttpRunnerManager 接口自动化测试平台 搭建实践

故事扮演 提交于 2020-02-15 16:55:03
一、需要准备的知识点   1. linux: 安装 python3、nginx 安装和配置、mysql 安装和配置   2. python: django 配置、uwsgi 配置 二、我搭建的环境   1. Centos7 (配置 rabbitmq、mysql 、Supervisord)   2. python 3.6.8 (配置 django、uwsgi)   3. git 1.8.3.1 (克隆代码) 三、搭建过程   1. 配置数据库(安装 mysql ,自行百度)     新建库:httprunner (UI 工具直接新建)   2. 安装 rabbitmq(消息中间件)      教程 >>>   3. 克隆代码     git clone https://github.com/HttpRunner/HttpRunnerManager.git   4. 安装项目依赖库     pip install -r requirements.txt   5. 修改 setting.py 配置文件 """ Django settings for HttpRunnerManager project. Generated by 'django-admin startproject' using Django 1.11.7. For more information on this

python实现简单的邮件发送带附件(异步报警与监控)

左心房为你撑大大i 提交于 2020-02-15 09:07:32
项目背景 异步任务队列的主要应用场景在: 无须实现响应,性能占用较大,任务处理时间较长的任务,如占用网络性能的发送邮件,占用IO性能的视频处理。 按时发布的定时任务,如定期对服务器的检查,对当天网站的监测分析。 Celery组件简介 Celery(芹菜)是一个Python编写的异步任务队列/基于分布式消息传递的作业队列。用于处理数以百万计的任务。 三大组件: 消息中间件 (Broker),任务执行单元(Worker)和 任务执行结果存储(Backend)。 Celery支持RabbitMQ、Redis、ZoopKeeper等作为Broker,而对这些消息队列的抽象,都是通过Kombu实现的。 Flower是基于web的 监控 和管理Celery的实时监控工具。    Redis(Remote Dictionary Server)远程字典数据服务的缩写,由意大利人开发的是一款内存高速缓存数据库。 安装项目所需软件: 安装redis,可参考前面redis博客 pip install celery pip install flower 也可告诉下载 pip install - i https : // pypi . douban . com / simple celery pip install - i https : // pypi . douban . com / simple

celery rabbit mq 详解

久未见 提交于 2020-02-14 17:47:42
Celery介绍和基本使用 Celery 是一个 基于python开发的分布式异步消息任务队列,通过它可以轻松的实现任务的异步处理, 如果你的业务场景中需要用到异步任务,就可以考虑使用celery, 举几个实例场景中可用的例子: 1)你想对100台机器执行一条批量命令,可能会花很长时间 ,但你不想让你的程序等着结果返回,而是给你返回 一个任务ID,你过一段时间只需要拿着这个任务id就可以拿到任务执行结果, 在任务执行ing进行时,你可以继续做其它的事情。 2)你想做一个定时任务,比如每天检测一下你们所有客户的资料,如果发现今天 是客户的生日,就给他发个短信祝福 Celery 在执行任务时需要通过一个消息中间件来接收和发送任务消息,以及存储任务结果, 一般使用rabbitMQ or Redis,后面会讲 1.1 Celery有以下优点: 简单:一单熟悉了celery的工作流程后,配置和使用还是比较简单的 高可用:当任务执行失败或执行过程中发生连接中断,celery 会自动尝试重新执行任务 快速:一个单进程的celery每分钟可处理上百万个任务 灵活: 几乎celery的各个组件都可以被扩展及自定制 Celery包含如下组件: Celery Beat:任务调度器,Beat进程会读取配置文件的内容周期性地将配置中到期需要执行的任务发送给任务队列。 Celery Worker

python celery 多work多队列

天大地大妈咪最大 提交于 2020-02-13 22:31:52
1.Celery模块调用 既然celery是一个分布式的任务调度模块,那么celery是如何和分布式挂钩呢,celery可以支持多台不通的计算机执行不同的任务或者相同的任务。 如果要说celery的分布式应用的话,就要提到celery的消息路由机制,AMQP协议。具体的可以查看AMQP的文档。简单地说就是可以有多个消息队列(Message Queue),不同的消息可以指定发送给不同的Message Queue,而这是通过Exchange来实现的。发送消息到Message Queue中时,可以指定routiing_key,Exchange通过routing_key来把消息路由(routes)到不同的Message Queue中去。 多worker,多队列,实例: 1.在服务器上编写文件tasks.py。首先定义一个Celery的对象,然后通过celeryconfig.py对celery对象进行设置。之后又分别定义了三个task,分别是taskA, taskB和add。 #!/usr/bin/env #-*-conding:utf-8-*- from celery import Celery,platforms platforms.C_FORCE_ROOT = True app = Celery() app.config_from_object("celeryconfig") @app

如何将CELERY放到后台执行?

戏子无情 提交于 2020-02-09 18:33:27
在作正式环境,这个是必须的。 于是找了两小时文档, 以下这个方法,相对来说好实现。 就是要注意supervisord.conf的目录存放位置。 放在DJANGO的PROJ目录下,是最佳位置。 https://thomassileo.name/blog/2012/08/20/how-to-keep-celery-running-with-supervisor/ 如何你不幸的和我一样,无法PIP只能用setup.py的话,可能celery和supervisord都要用绝对目录 [program:celeryd] command=/usr/local/python27/bin/celery worker --app=ism -c 4 -l info stdout_logfile=/var/log/celeryd.log stderr_logfile=/var/log/celeryd.log autostart=true autorestart=true startsecs=10 stopwaitsecs=600    ~~~~~~~~~~~~~~~~ How to keep Celery running with supervisor Mon 20 August 2012 by Thomas Sileo Supervisor is a Python program that allows