Celery raises ValueError: not enough values to unpack

后端 未结 5 1191
误落风尘
误落风尘 2021-01-31 00:00

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



        
相关标签:
5条回答
  • 2021-01-31 00:32

    Which celery version? As far as I remember celery isn't supported in windows since celery 4

    0 讨论(0)
  • 2021-01-31 00:43

    For Celery 4.1 on Windows.

    Set an environment variable FORKED_BY_MULTIPROCESSING=1. Then you can simply run celery -A <celery module> worker.

    0 讨论(0)
  • 2021-01-31 00:45

    It worked for me:

    celery -A my_project_name worker --pool=solo -l info
    

    basically things become single threaded and are suppoted

    0 讨论(0)
  • 2021-01-31 00:56

    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

    0 讨论(0)
  • 2021-01-31 00:57

    I got this error on Windows 7 32bit system. So I did this to make it work.

    Add this

    `os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')` 
    

    before defining a celery instance in myproj/settings.py file in your django project.

    It should like like

    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproj.settings')
    os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')
    
    app = Celery('tasks', broker='redis://127.0.0.1:6379/0')
    

    I am using redis as a messaging broker so defined broker='redis://127.0.0.1:6379/0'

    0 讨论(0)
提交回复
热议问题