Celery3.1.24 兼容python3.7问题

celery3.1.25

python3.7

 

语法错误

本地调试是python3.6

将环境切换成3.6.8

 

miniconda 环境 执行 服务

# /etc/supervisor/conf.d/hello.ini
[program:hello]
command=/usr/bin/mod_wsgi-express start-server --log-level debug --server-root /www/wsgi.run/hello --host 0.0.0.0 --port 29032 --user apache app.py
directory=/www/wsgi/hello
environment=prometheus_multiproc_dir="/data/prometheus/hello"

[program:hello.celeryapp]
# 切换成apache用户执行,否则无法在相应目录生成文件,会有权限问题
user=apache
command=/data/miniconda3/envs/e.py36/bin/celery worker -A app.celery --loglevel=debug -f /www/wsgi.run/hello/celeryworker.log
directory=/www/wsgi/hello
environment=PATH="/data/miniconda3/envs/e.py36/"

 

(e.py36) [root@10-10-91-95 hello]# /data/miniconda3/envs/e.py36/bin/celery worker -A app.celery --loglevel=debug -f /www/wsgi.run/hello/celeryworker.log
Running a worker with superuser privileges when the
worker accepts messages serialized with pickle is a very bad idea!

If you really want to continue then you have to set the C_FORCE_ROOT
environment variable (but please think about this before you do).

User information: uid=0 euid=0 gid=0 egid=0

(e.py36) [root@10-10-91-95 logsearchapi]#


解决方法:

celery3.1中的变量asyn,在python3.7中是关键字,直到celery4,没有对变量async改名。换句话说即使celery4与python3.7配合使用,仍然会出现这个问题。

因此需要将将python降级成python3.6版本

 

 

 

 

兼容问题:

https://stackoverflow.com/questions/50511905/cannot-start-celery-worker-kombu-asynchronous-timer

http://www.beixiongxiong.com/course/10103254/2129/

https://www.twblogs.net/a/5d0517b1bd9eee47d34bda4b/zh-cn

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值