win10 Celery异步任务报错: Task handler raised error: ValueError('not enough values to unpack (expecte

示例代码如下:

from celery import Celery

app = Celery('tasks', backend='redis://×××:6379/1', broker='redis://×××:6379/0')


@app.task
def add(x, y):
    return x + y

执行worker正常:

celery -A task worker --loglevel=info

但是在执行task时报错:Task handler raised error: ValueError('not enough values to unpack (expected 3, got 0)

add.delay(12,24)

报错原因:win10调用celery4.x版本的时候会出现这样的问题

解决办法:

1、安装eventlet

pip install eventlet

2、启动worker的时候加个参数

celery -A task worker --loglevel=info -P eventlet

然后调用就正常了,查看redis中的返回结果也正确了

win10 Celery异步任务报错: Task handler raised error: ValueError('not enough values to unpack (expecte

 

 

celery学习教程:https://www.celerycn.io/ru-men/celery-chu-ci-shi-yong

上一篇:[LeetCoe 1116.] 打印零与奇偶数


下一篇:docker-e参数,顺利收获Offer