我正在使用git repo https://github.com/celery/librabbitmq的最新master分支,并按照自述文件中的说明为Python 3.6安装librabbitmq==2.0.0
您可以通过执行以下操作来克隆存储库:
$ git clone git://github.com/celery/librabbitmq.git
然后通过执行以下操作安装它:
$ cd librabbitmq
$ make install # or make develop
这样可以正常工作(在操作系统中为c compliation安装某些二进制文件后),但是当我创建一个小的a+b
添加任务并用add.delay(2,2)
调用它时,它会失败并出现以下错误。我抬头看到Celery 4使用json作为序列化器,所以显然不是因为如果pickle序列化
[2018-04-30 23:40:02,956:CRITICAL / MainProcess]无法恢复的错误: SystemError('返回带有错误集的结果',)Traceback(大多数 最近的呼叫最后):文件 " /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/kombu/messaging.py" ;, 第624行,在_receive_callback中 如果on_m,则返回on_m(消息)self.receive(已解码,消息)文件 " /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/consumer/consumer.py" ;, 第570行,在on_task_received中 回调,文件" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/strategy.py", 第145行,在task_message_handler中 handle(req)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/worker.py", 第_ 221行,在_process_task_sem中 return self._quick_acquire(self._process_task,req)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/kombu/async/semaphore.py", 第62行,获得 回调(* partial_args,** partial_kwargs)文件" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/worker.py", 第226行,在_process_task中 req.execute_using_pool(self.pool)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/request.py", 第531行,在execute_using_pool中 correlation_id = task_id,File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/concurrency/base.py", 第155行,在apply_async中 **选项)文件" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/billiard/pool.py", 第1486行,在apply_async中 self._quick_put((TASK,(result._job,None,func,args,kwds)))文件 " /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/concurrency/asynpool.py" ;, 第813行,在send_job中 body = dumps(tup,protocol = protocol)TypeError:不能腌制内存查看对象
上述异常是导致以下异常的直接原因:
Traceback(最近一次调用最后一次):文件 " /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/worker.py" ;, 第203行,开头 self.blueprint.start(self)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/bootsteps.py", 第119行,开头 step.start(parent)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/bootsteps.py", 第370行,开始 return self.obj.start()File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", 第320行,开始 blueprint.start(self)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/bootsteps.py", 第119行,开头 step.start(parent)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", 第596行,开始 c.loop(* c.loop_args())File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/celery/worker/loops.py", 第88行,在asynloop next(loop)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/kombu/async/hub.py", 第354行,在create_loop中 cb(* cbargs)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/kombu/transport/base.py", 第236行,在on_readable上 reader(loop)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/kombu/transport/base.py", 第218行,在_read drain_events(timeout = 0)File" /Users/somghosh/.virtualenvs/ctdb/lib/python3.6/site-packages/librabbitmq-2.0.0-py3.6-macosx-10.6-intel.egg/librabbitmq /init.py" ;, 第227行,在drain_events中 self._basic_recv(timeout)SystemError:返回错误集
的结果
答案 0 :(得分:0)
不建议将此库用作celery的Rabbitmq代理。相反,请尝试py-amqp。这样可以更轻松地维护并且减少错误。