BUG——Celery ValueError: not enough values to unpack
背景
最近因项目需要,学习任务队列Celery的用法,跟着官网写Demo,出现如题错误,最终在github的Issues里找到解决办法,记录如下。
场景还原
本地环境如下:
- Windows 7
- Python 3.6.7
- Celery 4.1.0
代码tasks.py:
from celery import Celery
app = Celery('tasks', broker='redis://:xxxx@xxx.xxx.xxx.xx:6379/0')
@app.task
def add(x, y):
return x + y
执行worker
celery -A tasks worker --loglevel=info
输出:
-------------- celery@YG_lin v4.2.1 (windowlicker)
---- **** -----
--- * *** * -- Windows-7-6.1.7601-SP1 2018-12-05 20:03:58
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app: tasks:0x38527b8
- ** ---------- .> transport: redis://:**@192.168.0.2:6379//
- ** ---------- .> results: redis://:**@192.168.0.2:6379/1
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
-------------- [queues]
.> celery exchange=celery(direct) key=celery
[tasks]
. tasks.add
[2018-12-05 20:03:58,721: INFO/MainProcess] Connected to redis://:**@192.168.0.2:6379//
[2018-12-05 20:03:58,735: INFO/MainProcess] mingle: searching for neighbors
[2018-12-05 20:03:58,976: INFO/SpawnPoolWorker-1] child process 16292 calling self.run()
[2018-12-05 20:03:59,006: INFO/SpawnPoolWorker-2] child process 14764 calling self.run()
[2018-12-05 20:03:59,026: INFO/SpawnPoolWorker-3] child process 13864 calling self.run()
[2018-12-05 20:03:59,078: INFO/SpawnPoolWorker-4] child process 15980 calling self.run()
[2018-12-05 20:03:59,893: INFO/MainProcess] mingle: all alone
[2018-12-05 20:03:59,915: INFO/MainProcess] celery@YG_lin ready.
打开另一个python终端:
>>>from tasks import add
>>>add.delay(4, 4)
然后worker里报错:
[2018-12-05 20:03:59,933: ERROR/MainProcess] Task handler raised error: ValueError('not enough values to unpack (expected 3, got 0)',)
Traceback (most recent call last):
File "c:\users\administrator\envs\dj11.7\lib\site-packages\billiard\pool.py", line 358, in workloop
result = (True, prepare_result(fun(*args, **kwargs)))
File "c:\users\administrator\envs\dj11.7\lib\site-packages\celery\app\trace.py", line 537, in _fast_trace_task
tasks, accept, hostname = _loc
ValueError: not enough values to unpack (expected 3, got 0)
[2018-12-05 20:04:15,392: INFO/MainProcess] Received task: tasks.add[b76c9d02-ca3c-4272-b593-89c280f633da]
[2018-12-05 20:04:15,399: ERROR/MainProcess] Task handler raised error: ValueError('not enough values to unpack (expected 3, got 0)',)
Traceback (most recent call last):
File "c:\users\administrator\envs\dj11.7\lib\site-packages\billiard\pool.py", line 358, in workloop
result = (True, prepare_result(fun(*args, **kwargs)))
File "c:\users\administrator\envs\dj11.7\lib\site-packages\celery\app\trace.py", line 537, in _fast_trace_task
tasks, accept, hostname = _loc
ValueError: not enough values to unpack (expected 3, got 0
解决:
看别人描述大概就是说win10上运行celery4.x就会出现这个问题,解决办法如下,原理未知:
先安装一个eventlet
pip install eventlet
然后启动worker的时候加一个参数,如下:
celery -A <mymodule> worker -l info -P eventlet
也就是
celery -A tasks worker -l info -P eventlet
然后就可以正常的调用了。
BUG——Celery ValueError: not enough values to unpack的更多相关文章
- Celery ValueError: not enough values to unpack (expected 3, got 0)的解决方案
Celery ValueError: not enough values to unpack (expected 3, got 0)的解决方案 背景 最近因项目需要,学习任务队列Celery的用法,跟 ...
- Celery 在Windows下启动worker时出现错误:ValueError: not enough values to unpack (expected 3, got 0)
在公司Linux环境下没有出现问题,在回到家后直接在Windows10下运行出现错误: ValueError: not enough values to unpack (expected 3, got ...
- celery 启用worker ValueError: not enough values to unpack
[2018-01-12 19:08:15,545: INFO/MainProcess] Received task: tasks.add[5d387722-5389-441b-9b01-a619b93 ...
- win10 Celery异步任务报错: Task handler raised error: ValueError('not enough values to unpack (expected 3, got 0)
示例代码如下: from celery import Celery app = Celery('tasks', backend='redis://×××:6379/1', broker='redis: ...
- SQLAlchemy 做migration的时候 ValueError: too many values to unpack
我在做数据库迁移的时候,使用sqlalchemy,出现一个问题 Traceback (most recent call last): File "/Volumes/Spano/Dropbox ...
- ValueError: too many values to unpack (expected 2)
记录下总是码错的地方 for key,value in final_table:#final_table is a dict 然后报错 File "./count_co_Mty_read_n ...
- ValueError: too many values to unpack tensorflow
使用tensorflow 的时候报错: result ,_= sess.run(ops)ValueError: too many values to unpack 其实是ops里面不止一个,返回解压成 ...
- Python: ValueError: too many values to unpack
eg1: >>>a,b=(1,2,3) Traceback (most recent call last): File "<stdin>",line ...
- Opencv ValueError: not enough values to unpack (expected 3, got 2)解决办法
问题背景 有些人在用我去年的毕设运行时(感谢QAQ),报错 Opencv ValueError: not enough values to unpack (expected 3, got 2) 当时就 ...
随机推荐
- mybatis初始化过程
mybatis初始化如下: //加载配置文件InputStream resourceAsStream = Resources.getResourceAsStream("testMybatis ...
- MySQL报错: Character set ‘utf8mb4‘ is not a compiled character set and is not specified in the ‘/usr/share/mysql/charsets/Index.xml‘ file
由于日常程序使用了字符集utf8mb4,为了避免每次更新时,set names utf8mb4,就把配置文件改了,如下: [root@~]# vim /etc/my.cnf #my.cnf [clie ...
- python DLL接口测试
#coding=utf-8 import clr import sys import threading from itertools import permutations sys.path.app ...
- sqoop的基本语法详解及可能遇到的错误
1 sqoop介绍 Apache Sqoop是专为Apache Hadoop和结构化数据存储如关系数据库之间的数据转换工具的有效工具.你可以使用Sqoop从外部结构化数据存储的数据导入到Hadoop分 ...
- Ubuntu强制重启后提示emergency mode
起因 win10+Ubuntu16.04双系统,在ubuntu下训练一个卷积网但是显存拙计卡死了,于是手贱强制按下电源开关重启. 现象 重启后从grub进ubuntu,并不进图形化的登录界面,而是提示 ...
- DDD工作流持久化(十六)
找到对应的sql文件执行sql语句 产生如下的表: 添加引用: 添加命名空间: using System.Activities.DurableInstancing; using System.Runt ...
- asp.net core 缓存和Session
缓存 缓存在内存中 ASP.NET Core 使用 IMemoryCache内存中缓存是使用依赖关系注入从应用中引用的服务. 请在ConfigureServices中调用AddMemoryCache( ...
- UE4 UPROPERTY UFUNCTION
http://blog.csdn.net/sinat_27456831/article/details/52800514
- Ncurses-窗口
前面介绍过标准屏幕 stdscr, stdscr 只是 WINDOW 结构的一个特例. 我们可以使用函数 newwin 和 delwin 来创建和销毁窗口 WINDOW *newwin(int num ...
- 利用Jmeter做接口测试的时候,如何提取头部的JSESSIONID然后传递到下一个请求,继续完成当前用户的请求。
其实,关于这个问题有三种种解决方法: 1)从响应数据里面提取JSESSIONID,点击链接可以查看https://www.cnblogs.com/liulinghua90/p/5320290.html ...