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 ...
随机推荐
- centos修改ssh默认端口号的方法
修改/etc/ssh/sshd_config配置文件(注意:这里是sshd_config,而不是ssh_config) vi /etc/ssh/sshd_config 在sshd_config文件中添 ...
- YbtOJ#463-序列划分【二分答案,线段树,dp】
正题 题目链接:https://www.ybtoj.com.cn/problem/463 题目大意 给出长度为\(n\)的序列\(A,B\).要求划分成若干段满足 对于任何\(i<j\),若\( ...
- LR Socket接收超时TPS上不去解决方法
在一次做项目中,由于Socket协议接收的报文会有不定长度,基本每次都会有变化,在data.ws 接收buf1有固定长度,这是在接收的实时报文会有长度不一致的问题.这时LR默认会去与接收的报文的长度及 ...
- Sentry 监控 - Distributed Tracing 分布式跟踪
系列 1 分钟快速使用 Docker 上手最新版 Sentry-CLI - 创建版本 快速使用 Docker 上手 Sentry-CLI - 30 秒上手 Source Maps Sentry For ...
- 安装SpaCy出现报错:requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443):
内含安装步骤及报错解决:https://www.cnblogs.com/xiaolan-Lin/p/13286885.html
- JVM 面试题,安排上了!!!
肝了一篇非常硬核的 JVM 基础总结,写作不易,小伙伴们赶紧点赞.转发安排起来! 原文链接 据说看完这篇 JVM 要一小时 JVM 的主要作用是什么? JVM 就是 Java Virtual Mach ...
- 安装 webstorm--->vue
一.先去官网下载webstorm https://www.jetbrains.com/ 不论是Mac的还是win得都有相应的版本, 二.再去官网下载git https://git-sc ...
- SudokuSolver 2.0:用C++实现的数独解题程序 【一】
SudokuSolver 2.0 实现效果 H:\Read\num\Release>sudoku.exe Order please: Sudoku Solver 2.0 2021/10/2 by ...
- Go语言核心36讲(Go语言进阶技术一)--学习笔记
07 | 数组和切片 我们这次主要讨论 Go 语言的数组(array)类型和切片(slice)类型. 它们的共同点是都属于集合类的类型,并且,它们的值也都可以用来存储某一种类型的值(或者说元素). 不 ...
- 激活NX窗口的按钮
原理:取得按钮名称以后,通过运行宏文件激活按钮 Imports System.IO Imports System.Runtime.InteropServices Imports NXOpen.Menu ...