如何在金字塔中使用pyramid_celery?

时间:2015-03-04 16:53:28

标签: python celery pyramid

我想用金字塔芹菜。 尝试使用pyramid_celery包。 Аll尝试失败了。

我的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

当我尝试运行此命令时:

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

每次,当我尝试运行芹菜时,输出错误都不同:

_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

谁能告诉我,我做错了什么?

谢谢!

1 个答案:

答案 0 :(得分:4)

在Linux下运行。所有问题都消失了!

  • 不要在窗户上使用芹菜!
  • 不要在windows下开发python!

This is log from celery starting