(env) D:python_learnmeiduo_projectmeiduo_mall>celery -A celery_tasks.main worker -l info -------------- celery@CZZI-BBMGSW v4.4.6 (cliffs) --- ***** ----- -- ******* ---- Windows-7-6.1.7601-SP1 2020-07-18 23:06:20 - *** --- * --- - ** ---------- [config] - ** ---------- .> app: meiduo:0x3676250 - ** ---------- .> transport: amqp://admin:**@192.168.2.155:5672// - ** ---------- .> results: disabled:// - *** --- * --- .> concurrency: 4 (prefork) -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker) --- ***** ----- -------------- [queues] .> celery exchange=celery(direct) key=celery [tasks] . ccp_send_sms_code [2020-07-18 23:06:21,241: INFO/MainProcess] Connected to amqp://admin:**@192.168.2.155:5672// [2020-07-18 23:06:21,257: INFO/MainProcess] mingle: searching for neighbors [2020-07-18 23:06:21,422: INFO/SpawnPoolWorker-1] child process 14532 calling self.run() [2020-07-18 23:06:21,422: INFO/SpawnPoolWorker-2] child process 16500 calling self.run() [2020-07-18 23:06:21,462: INFO/SpawnPoolWorker-3] child process 9492 calling self.run() [2020-07-18 23:06:21,613: INFO/SpawnPoolWorker-4] child process 7784 calling self.run() [2020-07-18 23:06:22,318: INFO/MainProcess] mingle: all alone [2020-07-18 23:06:22,374: INFO/MainProcess] celery@CZZI-BBMGSW ready. [2020-07-18 23:08:42,415: INFO/MainProcess] Received task: ccp_send_sms_code[9dc4d018-b1fb-45e0-b395-89ba2b952146] [2020-07-18 23:08:42,448: ERROR/MainProcess] Task handler raised error: ValueError('not enough values to unpack (expected 3, got 0)') Traceback (most recent call last): File "d:python_learnmeiduo_projectenvlibsite-packagesilliardpool.py", line 362, in workloop result = (True, prepare_result(fun(*args, **kwargs))) File "d:python_learnmeiduo_projectenvlibsite-packagesceleryapp race.py", line 600, in _fast_trace_task tasks, accept, hostname = _loc ValueError: not enough values to unpack (expected 3, got 0)
celery 4.x 对windows的支持并不是那么好。所以我们需要做一些额外的工作。
方法一:
添加--pool=solo参数
celery -A celery_tasks.main worker --pool=solo -l log
方法二:
安装一个gevent
pip install gevent
再次启动celery执行任务:
celery -A celery_tasks.main worker -l info -P gevent
问题解决