Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Celery raises ValueError: not enough values to unpack

Tags:

Trying to run simple example with Celery and receiving an exception. RabbitMQ started in a Docker, also tried to start it locally. Celery works on a local Windows host

from celery import Celery  app = Celery('tasks', broker='amqp://192.168.99.100:32774')  @app.task() def hello():     print('hello')   if __name__ == '__main__':     hello.delay() 

Excerpt of my error text:

[2017-08-18 00:01:08,632: ERROR/MainProcess] Task handler raised error: ValueError('not enough values to unpack (expected 3, got 0)',) Traceback (most recent call last):                                                   File "c:\users\user\celenv\lib\site-packages\billiard\pool.py", line 358, in workloop                                 result = (True, prepare_result(fun(*args, **kwargs)))                                       File "c:\users\user\celenv\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) 
like image 836
Igor Nikolaev Avatar asked Aug 17 '17 21:08

Igor Nikolaev


1 Answers

Celery 4.0+ does not officially support Windows yet. But it still works on Windows for some development/test purposes.

Use eventlet instead as below:

pip install eventlet celery -A <module> worker -l info -P eventlet 

It works for me on Windows 10 + celery 4.1 + python 3.

===== update 2018-11 =====

Eventlet has an issue on subprocess.CalledProcessError:

https://github.com/celery/celery/issues/4063

https://github.com/eventlet/eventlet/issues/357

https://github.com/eventlet/eventlet/issues/413

So try gevent instead.

pip install gevent celery -A <module> worker -l info -P gevent 

This works for me on Windows 10 + celery 4.2 + python 3.6

like image 90
Samuel Chen Avatar answered Oct 05 '22 14:10

Samuel Chen