芹菜运行错误



我根据此链接中的教程制作了一个 Celery 应用程序,但我只是一些错误。谷歌搜索后,我降级到Celery版本3.1.25,声称是支持Windows的最后一个版本。但我得到的错误保持不变。 问题出在哪里?

# tasks.py
from celery import Celery
app = Celery('tasks', backend='amqp', broker='amqp://')
@app.task
def add(x, y):
    return x + y
@app.task(ignore_result=True)
def print_hello():
    print('hello there')
@app.task
def gen_prime(x):
    multiples = []
    results = []
    for i in range(2, x+1):
        if i not in multiples:
            results.append(i)
            for j in range(i*i, x+1, i):
                multiples.append(j)
    return results

我在芹菜运行命令提示符上收到的错误消息:

C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.
Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')
-------------- celery@pc v4.2.1 (windowlicker)
---- **** -----
--- * ***  * -- Windows-10-10.0.17134-SP0 2018-1-28 08:19:41
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app:         tasks:0x262e454cba8
- ** ---------- .> transport:   amqp://guest:**@localhost:5672//
- ** ---------- .> results:     amqp://
- *** --- * --- .> concurrency: 8 (prefork)
-- ******* ---- .> task events: ON
--- ***** -----
-------------- [queues]
                .> celery           exchange=celery(direct) key=celery

[tasks]
. tasks.add
. tasks.gen_prime
. tasks.print_hello
[2018-1-28 08:19:41,369: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672//
[2018-1-28 08:19:41,490: INFO/MainProcess] mingle: searching for neighbors
[2018-1-28 08:19:42,676: INFO/SpawnPoolWorker-5] child process 5904 calling self.run()
[2018-1-28 08:19:42,685: INFO/SpawnPoolWorker-1] child process 15432 calling self.run()
[2018-1-28 08:19:42,688: WARNING/SpawnPoolWorker-5] C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.
Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')
[2018-1-28 08:19:42,690: INFO/SpawnPoolWorker-3] child process 9580 calling self.run()
[2018-1-28 08:19:42,697: WARNING/SpawnPoolWorker-1] C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.
Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')
[2018-1-28 08:19:42,700: INFO/SpawnPoolWorker-2] child process 15660 calling self.run()
[2018-1-28 08:19:42,703: WARNING/SpawnPoolWorker-3] C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.
Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')
[2018-1-28 08:19:42,710: WARNING/SpawnPoolWorker-2] C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.
Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')
[2018-1-28 08:19:42,724: INFO/SpawnPoolWorker-7] child process 2612 calling self.run()
[2018-1-28 08:19:42,724: INFO/SpawnPoolWorker-6] child process 15192 calling self.run()
[2018-1-28 08:19:42,725: INFO/SpawnPoolWorker-4] child process 5276 calling self.run()
[2018-1-28 08:19:42,731: INFO/SpawnPoolWorker-8] child process 16112 calling self.run()
[2018-1-28 08:19:42,733: WARNING/SpawnPoolWorker-6] C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.
[2018-1-28 08:19:42,733: WARNING/SpawnPoolWorker-7] C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.     Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')
[2018-1-28 08:19:42,734: WARNING/SpawnPoolWorker-4] C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.
Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')
[2018-1-28 08:19:42,739: WARNING/SpawnPoolWorker-8] C:Python3libsite-packagescelerybackendsamqp.py:67: CPendingDeprecationWarning:
    The AMQP result backend is scheduled for deprecation in     version 4.0 and removal in version v5.0.
Please use RPC backend or a persistent backend.
alternative='Please use RPC backend or a persistent backend.')
[2018-1-28 08:19:42,792: INFO/MainProcess] mingle: all alone
[2018-1-28 08:19:42,802: INFO/MainProcess] celery@sh-int24 ready.
[2018-1-28 20:00:12,625: INFO/MainProcess] Received task: tasks.gen_prime[d293687a-c032-47e4-b9b2-4097a448d5e7]
[2018-1-28 20:00:12,688: ERROR/MainProcess] Task handler raised error: ValueError('not enough values to unpack (expected 3, got 0)',)
Traceback (most recent call last):
File "C:Python3libsite-packagesbilliardpool.py", line 358, in workloop
    result = (True, prepare_result(fun(*args, **kwargs)))
File "C:Python3libsite-packagesceleryapptrace.py", line 537, in _fast_trace_task
    tasks, accept, hostname = _loc
ValueError: not enough values to unpack (expected 3, got 0)

还有我发出的命令: celery -A tasks worker

我使用Windows 10和python 3.6 anaconda发行版。

如此拉取请求中所述,您将需要

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

在"应用 = 芹菜...">

相关内容

  • 没有找到相关文章

最新更新