redis / rq worker在python3上中断

时间:2018-11-20 14:13:24

标签: python python-3.x redis containers python-2.x

所以在rq worker中执行代码时出现错误

 File "/usr/local/bin/rq", line 11, in <module>
   sys.exit(main())
 File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
   return self.main(*args, **kwargs)
 File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
   rv = self.invoke(ctx)
 File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
   return _process_result(sub_ctx.command.invoke(sub_ctx))
 File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
   return ctx.invoke(self.callback, **ctx.params)
 File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
   return callback(*args, **kwargs)
 File "/usr/local/lib/python3.7/site-packages/rq/cli/cli.py", line 75, in wrapper
   return ctx.invoke(func, cli_config, *args[1:], **kwargs)
 File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
   return callback(*args, **kwargs)
 File "/usr/local/lib/python3.7/site-packages/rq/cli/cli.py", line 236, in worker
   worker.work(burst=burst, logging_level=logging_level)
 File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 493, in work
   self.execute_job(job, queue)
 File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 662, in execute_job
   self.fork_work_horse(job, queue)
 File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 599, in fork_work_horse
   self.main_work_horse(job, queue)
 File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 677, in main_work_horse
   success = self.perform_job(job, queue)
 File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 781, in perform_job
   self.prepare_job_execution(job)
 File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 706, in prepare_job_execution
   registry.add(job, timeout, pipeline=pipeline)
 File "/usr/local/lib/python3.7/site-packages/rq/registry.py", line 47, in add
   return pipeline.zadd(self.key, score, job.id)
 File "/usr/local/lib/python3.7/site-packages/redis/client.py", line 2263, in zadd
   for pair in iteritems(mapping):
 File "/usr/local/lib/python3.7/site-packages/redis/_compat.py", line 123, in iteritems
return iter(x.items())

AttributeError: 'int' object has no attribute 'items'
14:04:29 Moving job to 'failed' queue (work-horse terminated unexpectedly; waitpid returned 256)

我试图在openshift上的解耦容器中运行此代码。相同的图像在本地工作。我猜唯一的区别是,在本地尝试时,我是在系统上而不是在容器上运行rq worker,而我的本地只有python 2和3,而openshift只有python3。

任何人都可以解决为什么它开始表现出这种现象。我怀疑其归因于python版本。但是我不知道如何在python 2中运行redis/ rq worker

1 个答案:

答案 0 :(得分:0)

这是一个已知问题,由redis-py的新版本3引起-请参见https://github.com/rq/rq/issues/1014