简体   繁体   English

如何在金字塔中使用pyramid_celery?

[英]How to use pyramid_celery in pyramid?

I want to use celery with pyramid. 我想把芹菜和金字塔一起使用。 Try to use pyramid_celery package. 尝试使用pyramid_celery软件包。 Аll attempts have failed. 所有尝试均失败。

My development.ini has: 我的development.ini有:

BROKER_URL = amqp://dev:dev@192.168.1.50:5672//test
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json', 'application/json']
CELERY_RESULT_BACKEND = amqp://dev:dev@192.168.1.50:5672//test
;CELERY_ACCEPT_CONTENT = json12
CELERY_IMPORTS = celerypythontest.celery_service

And when i try to run this command: 当我尝试运行此命令时:

celery worker -A pyramid_celery.celery_app --ini development.ini

i have this output: 我有这个输出:

H:\\Development\\CeleryPythonTest>celery worker -A pyramid_celery.celery_app --ini development.ini H:\\ Development \\ CeleryPythonTest>芹菜工作者-A pyramid_celery.celery_app --ini development.ini

 -------------- celery@CUBA v3.1.17 (Cipater)
---- **** -----
--- * ***  * -- Windows-8-6.2.9200
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app:         __main__:0x3c550b8
- ** ---------- .> transport:   amqp://dev:**@192.168.1.50:5672//test
- ** ---------- .> results:     amqp://dev:dev@192.168.1.50:5672//test
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ----
--- ***** ----- [queues]
 -------------- .> celery           exchange=celery(direct) key=celery


2015-03-04 19:41:34,963 ERROR [celery.worker][MainThread] Unrecoverable error: PicklingError("Can't pickle <function ViewDeriver._response_resolved_view.<locals>.viewresult_to_response at 0x00000000051DF378>: attribute lookup ViewDeriver._response_resolved_view.
<locals>.viewresult_to_response on pyramid.static failed",)
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\celery\worker\__init__.py", line 206, in start
    self.blueprint.start(self)
  File "C:\Python34\lib\site-packages\celery\bootsteps.py", line 123, in start
    step.start(parent)
  File "C:\Python34\lib\site-packages\celery\bootsteps.py", line 374, in start
    return self.obj.start()
  File "C:\Python34\lib\site-packages\celery\concurrency\base.py", line 131, in start
    self.on_start()
  File "C:\Python34\lib\site-packages\celery\concurrency\prefork.py", line 117, in on_start
    **self.options)
  File "C:\Python34\lib\site-packages\billiard\pool.py", line 966, in __init__
    self._create_worker_process(i)
  File "C:\Python34\lib\site-packages\billiard\pool.py", line 1062, in _create_worker_process
    w.start()
  File "C:\Python34\lib\site-packages\billiard\process.py", line 137, in start
    self._popen = Popen(self)
  File "C:\Python34\lib\site-packages\billiard\forking.py", line 263, in __init__
    dump(process_obj, to_child, HIGHEST_PROTOCOL)
  File "C:\Python34\lib\site-packages\billiard\py3\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
_pickle.PicklingError: Can't pickle <function ViewDeriver._response_resolved_view.<locals>.viewresult_to_response at 0x00000000051DF378>: attribute lookup ViewDeriver._response_resolved_view.<locals>.viewresult_to_response on pyramid.static failed

H:\Development\CeleryPythonTest>Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python34\lib\site-packages\billiard\forking.py", line 459, in main
    self = load(from_parent)
EOFError: Ran out of input

And every time, when i try to run celery, the output error is different: 而且每次我尝试运行celery时,输出错误都不同:

_pickle.PicklingError: Can't pickle <InterfaceClass pyramid.request.__static/_IRequest>: attribute lookup __static/_IRequest on pyramid.request failed


_pickle.PicklingError: Can't pickle <function _compile_route.<locals>.matcher at 0x0000000004BB0620>: attribute lookup _compile_route.<locals>.matcher on pyramid.urldispatch failed

_pickle.PicklingError: Can't pickle <function beforerender_subscriber at 0x0000000003CD8D90>: it's not the same object as pyramid_debugtoolbar.toolbar.beforerender_subscriber

Can anyone tell me, what i am doing wrong? 谁能告诉我,我在做什么错?

Thanks! 谢谢!

Run under Linux. 在Linux下运行。 And all problems gone! 所有的问题都消失了!

  • Don't use celery on windows! 不要在窗户上使用芹菜!
  • Don't develop on python under windows! 不要在Windows下在python上开发!

This is log from celery starting 这是芹菜开始的日志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM