跟着官方的入门教程部署和运行的,为啥报这个错?
tasks.py
# -*- encoding:UTF-8 -*- from celery import Celery brokers = ‘redis://localhost:6379‘ backend = ‘redis://localhost:6379‘ app = Celery(‘tasks‘, broker=brokers, backend=backend) app.control.purge() @app.task def add(x, y): return x + y
>>> from tasks import add >>> add.delay(6,6) <AsyncResult: e1b8521e-e8a1-4431-8232-b0cbe7a35e9e> [2017-08-08 19:14:32,580: ERROR/MainProcess] Task handler raised error: ValueErr or(‘not enough values to unpack (expected 3, got 0)‘,) Traceback (most recent call last): File "c:\python352\lib\site-packages\billiard\pool.py", line 358, in workloop result = (True, prepare_result(fun(*args, **kwargs))) File "c:\python352\lib\site-packages\celery\app\trace.py", line 525, in _fast_ trace_task tasks, accept, hostname = _loc ValueError: not enough values to unpack (expected 3, got 0) [2017-08-08 19:15:46,049: ERROR/MainProcess] Task handler raised error: ValueErr or(‘not enough values to unpack (expected 3, got 0)‘,) Traceback (most recent call last): File "c:\python352\lib\site-packages\billiard\pool.py", line 358, in workloop result = (True, prepare_result(fun(*args, **kwargs))) File "c:\python352\lib\site-packages\celery\app\trace.py", line 525, in _fast_ trace_task tasks, accept, hostname = _loc ValueError: not enough values to unpack (expected 3, got 0)
解决方案:celery -A your_app_name worker --pool=solo -l info 换这个试试
原文地址:https://www.cnblogs.com/yunlongaimeng/p/10291548.html
时间: 2024-11-13 14:05:50