2016-11-24 30 views
0

Celeryのドキュメントで以下のケースをテストしますが、ImproperlyConfigured例外を発生させます。 http://docs.celeryproject.org/en/master/userguide/calling.html#id3Celery raise不適切に設定された例外

Traceback (most recent call last): 
File "test.py", line 8, in <module> print(r.get(on_message=on_raw_message, propagate=False)) 
File "/usr/local/python2.7/lib/python2.7/site-packages/celery/result.py", line 189, in get on_message=on_message, 
File "/usr/local/python2.7/lib/python2.7/site-packages/celery/backends/base.py", line 460, in wait_for_pending 'Backend does not support on_message callback') 
celery.exceptions.ImproperlyConfigured: Backend does not support on_message callback 

テストコードです:セロリ-Aの

from celery_test.agent import hello 
from celery_test.celery import app 

def on_raw_message(body): 
    print(body) 

r = hello.apply_async(args=[122,34], queue='machine1', routing_key='machine1') 
print(r.get(on_message=on_raw_message, propagate=False)) 

出力が

[[email protected] script]# celery -A celery_test report 

software -> celery:4.0.0 (latentcall) kombu:4.0.0 py:2.7.9 
      billiard:3.5.0.2 py-amqp:2.1.1 
platform -> system:Linux arch:64bit, ELF imp:CPython 
loader -> celery.loaders.app.AppLoader 
settings -> transport:amqp results:amqp://[email protected]// 

CELERY_DEFAULT_EXCHANGE_TYPE: 'direct' 
CELERY_RESULT_SERIALIZER: 'json' 
timedelta: <type 'datetime.timedelta'> 
Exchange: <class 'kombu.entity.Exchange'> 
CELERY_INCLUDE: ['celery_test.agent'] 
absolute_import: _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 16384) 
Queue: <class 'kombu.entity.Queue'> 
CELERY_TASK_RESULT_EXPIRES: 3600 
CELERT_QUEUES: 
    (<unbound Queue machine1 -> 'agent' -> machine1>, 
<unbound Queue machine2 -> 'agent' -> machine2>) 
CELERY_ACCEPT_CONTENT: ['json'] 
CELERY_TASK_SERIALIZER: 'json' 
BROKER_URL: u'amqp://guest:********@192.168.1.201:5672//' 
CELERY_RESULT_BACKEND: u'amqp://[email protected]//' 
CELERY_DEFAULT_EXCHANGE: 'agent' 
+0

あなたは 'セロリ-A レポートを追加してくださいすることができ'問題の出力? –

+0

@ssudakeすでに 'celery -A report'の出力を追加しています –

+0

rabbitmqバックエンドで' on_message'コールバックがサポートされているかどうかはわかりません。これはセロリコードの最近の変更のようです。見てください[https://github.com/celery/celery/pull/3477/files](https://github.com/celery/celery/pull/3477/files) –

答えて

0

を報告celery_testどうやらセロリでいく​​つかのバグがあるように思われます。 on_messageは、rabbitmqバックエンドで動作するはずです。

回避方法:結果バックエンドの場合はredisに移動してください。

私はあなたが直面しているバグのために問題を作成したプル要求[ confirmation]、

https://github.com/celery/celery/pull/3477/files

を以下の時に導入さ

https://github.com/celery/celery/issues/3625

関連する問題