celery config
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
Queue('hipri', routing_key='tasks.#'),
),
CELERY_ROUTES={
'tasks.tasks.add': {'queue': 'hipri'},
}
)
*/
celery -A tasks worker --loglevel=info # run the worker
celery worker --help # list command-line options available
celery multi start w1 -A proj -l info # start one or more workers in the background
celery multi restart w1 -A proj -l info # restart workers
celery multi stop w1 -A proj -l info # stop workers aynchronously
celery multi stopwait w1 -A proj -l info # stop after executing tasks are completed
celery multi start w1 -A proj -l info --pidfile=/var/run/celery/%n.pid --logfile=/var/log/celery/%n%I.log # create pid and log files in the current directory
celery -A proj inspect active # control and inspect workers at runtime
celery -A proj inspect active --destination=celery@w1.computer
celery -A proj inspect scheduled # list scheduled ETA tasks.
celery -A proj control cancel_consumer # Force all worker to cancel consuming from a queue
celery -A proj control cancel_consumer foo -d worker1.local # Force an specified worker to cancel consuming from a queue
celery -A proj inspect active_queues # Get a list of queues that workers consume
celery -A proj inspect active_queues -d celery@worker1 # Get a list of queues that a worker consumes
celery -A proj inspect stats # show worker statistics.
celery shell -I # Drop into IPython console.
celery -A tasks result -t tasks.add dbc53a54-bd97-4d72-908c-937827009736 # See the result of a task.
# Control workers
i = app.control.inspect()
i = app.control.inspect(['worker1.example.com', 'worker2.example.com'])
i.registered() // Show registred tasks for specified workers
i.active() // Get a list of active tasks
i.scheduled // Get a list of tasks waiting to be scheduled
i.reserved() # Get a list of tasks that has been received, but are still waiting to be executed
i.active_queue() # get active queues
app.control.broadcast('shutdown') # shutdown all workers
app.control.broadcast('shutdown', destination=['celer@worker'])
app.control.ping()
app.control.ping(['celer@worker'])
# Inspecting queues in Redis
redis-cli -h HOST -p PORT -n DATABASE_NUMBER llen QUEUE_NAME
LRANGE queue_name 0 10 # Redis client
celery config的更多相关文章
- Python定时任务-schedule vs. Celery vs. APScheduler
在Python开发过程中我们经常需要执行定时任务,而此类任务我们通常有如下选项: 自己造轮子 使用schedule库 使用Celery定时任务 使用APScheduler 自己造轮子实现,最大的优势就 ...
- 一百四十七:CMS系统之celery实现邮件和短信异步发送
celery工作原理 celery官方文档:https://docs.celeryproject.org/en/latest/ 安装:pip install celery windows下还需安装ev ...
- 分布式任务队列 Celery
目录 目录 前言 简介 Celery 的应用场景 架构组成 Celery 应用基础 前言 分布式任务队列 Celery,Python 开发者必备技能,结合之前的 RabbitMQ 系列,深入梳理一下 ...
- opsmanage 自动化运维管理平台
关闭防火墙.selinux 更换阿里云 yum源 依赖环境 yum install -y epel-releaseyum install vim net-tools nmon htop rsync t ...
- celery 框架
转自:http://www.cnblogs.com/forward-wang/p/5970806.html 生产者消费者模式 在实际的软件开发过程中,经常会碰到如下场景:某个模块负责产生数据,这些数据 ...
- Celery 框架学习笔记
在学习Celery之前,我先简单的去了解了一下什么是生产者消费者模式. 生产者消费者模式 在实际的软件开发过程中,经常会碰到如下场景:某个模块负责产生数据,这些数据由另一个模块来负责处理(此处的模块是 ...
- 【Python】Celery异步处理
参考:http://www.cnblogs.com/znicy/p/5626040.html 参考:http://www.weiguda.com/blog/73/ 参考:http://blog.csd ...
- Celery,Tornado,Supervisor构建和谐的分布式系统
Celery 分布式的任务队列 与rabbitmq消息队列的区别与联系: rabbitmq 调度的是消息,而Celery调度的是任务. Celery调度任务时,需要传递参数信息,传输载体可以选择rab ...
- 使用Supervisor管理Celery进程。
讲过一篇celery的,但是celery启动后并不是daemon的,在生产环境中这肯定是不可以的,那怎么办呢? 这就需要使用supervisor进行进程管理了,下面详细介绍. 一. superviso ...
随机推荐
- P5287-[HNOI2019]JOJO【KMP】
正题 题目链接:https://www.luogu.com.cn/problem/P5287 题目大意 开始一个空串,\(n\)个操作 在末尾加入\(x\)个\(c\)字符(保证和\(c\)和前面的字 ...
- P7518-[省选联考2021A/B卷]宝石【主席树,二分】
正题 题目链接:https://www.luogu.com.cn/problem/P7518 题目大意 给出\(n\)个点的一棵树,每个点上有不大于\(m\)的数字. 然后给出一个长度为\(c\)的各 ...
- C#开发BIMFACE系列42 服务端API之图纸对比
BIMFACE二次开发系列目录 [已更新最新开发文章,点击查看详细] 在我的前一篇博客<C#开发BIMFACE系列42 服务端API之图纸对比>中详细介绍了BIMFACE服务端接口 ...
- 题解 UVA1500 Alice and Bob
题目传送门 题目大意 给出 \(n\) 堆石子,每次可以做以下两种操作之一: 将某两堆石子进行合并 将某一堆石子抽走一个石子 问谁必胜. 思路 就nm很妙好么? 首先,我们需要考虑每堆石子大小都 \( ...
- SimpleDateFormat、Date和String互转
今天在修改bug时遇到一个查询异常:根据时间段查询的时候,如果查询时间段含12点钟,那么能查到时间段之外的其他数据: 跟踪了数据流动发现,前同事写的程序中,有一处是讲前端传来时间字符串转为Date的一 ...
- Bloom Filter算法
Bloom Filter算法详解 什么是布隆过滤器 布隆过滤器(Bloom Filter)是 1970 年由布隆提出的.它实际上是一个很长的二进制向量和一系列随机映射函数 (下面详细说),实际上你也可 ...
- Java(14)面向对象之封装
作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15201610.html 博客主页:https://www.cnblogs.com/testero ...
- GAN实战笔记——第二章自编码器生成模型入门
自编码器生成模型入门 之所以讲解本章内容,原因有三. 生成模型对大多数人来说是一个全新的领域.大多数人一开始接触到的往往都是机器学习中的分类任务--也许因为它们更为直观:而生成模型试图生成看起来很逼真 ...
- Windows Terminal 和 WSL
Windows Terminal ,配置启动目录为 WSL : \\wsl$\Ubuntu\home
- xpath helper插件安装提示程序包无效
参考链接:https://www.jianshu.com/p/b7d782ef81e0 刚学到爬虫,需要在Chrome浏览器安装xpath helper插件结果一直提示"程序包无效" ...