python流行的定时任务+自动执行
记录学习过程
最近项目中遇到一些自动化部署的场景,通过celery定时器,在分布式系统实现任务异步执行效果,参考了一些网上的经验自己也记录下。
Celery定时任务
需要redis、celery、superovis
腾讯云服务器初始化的centos7,安装会出现各种问题
启动redis服务器
./redis-server …/redis.conf
启动supervisord守护进程
supervisord -c /home/supervisord.conf #到指定路径下去找配置文件
启动celery定时任务
celery -A schedule_tasks beat
celery -A schedule_tasks worker
celery -A tasks beat
celery -A tasks worker -l info #查看进程信息
celery -A tasks worker -l info -n worker.%h -Q celery
celery -A tasks worker -l info -n workerB.%h -Q for_task_B
![下班了先撤](https://img-blog.csdnimg.cn/20210427171349821.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly