python - celery task doesn't return result to client -


i'm trying setup simple worker return result client. however, client blocks forever, , there's no indication of errors on server.

the service:

from celery import celery import logging  logger = logging.getlogger(__name__) app = celery('service', broker='amqp://localhost', backend='rpc://localhost')  @app.task() def operation(x):     logger.info(x)     return 1 

the client:

from celery_test.service import operation  rv = operation.delay('foo') print rv.ready() print rv.get() 

server log:

[2015-07-08 14:15:02,529: debug/mainprocess] | worker: starting pool [2015-07-08 14:15:02,645: debug/mainprocess] ^-- substep ok [2015-07-08 14:15:02,648: debug/mainprocess] | worker: starting consumer [2015-07-08 14:15:02,650: debug/mainprocess] | consumer: starting connection [2015-07-08 14:15:02,680: debug/mainprocess] start server, version: 0.9, properties: {u'information': u'licensed under mpl.  see http://www.rabbitmq.com/', u'product': u'rabbitmq', u'copyrigh t': u'copyright (c) 2007-2014 gopivotal, inc.', u'capabilities': {u'exchange_exchange_bindings': true, u'connection.blocked': true, u'authentication_failure_close': true, u'basic.nack': true, u'per_co nsumer_qos': true, u'consumer_priorities': true, u'consumer_cancel_notify': true, u'publisher_confirms': true}, u'cluster_name': u'rabbit@ophir-pc', u'platform': u'erlang/otp', u'version': u'3.5.3'}, mechanisms: [u'amqplain', u'plain'], locales: [u'en_us'] [2015-07-08 14:15:02,724: debug/mainprocess] open ok! [2015-07-08 14:15:02,724: info/mainprocess] connected amqp://guest:**@127.0.0.1:5672// [2015-07-08 14:15:02,726: debug/mainprocess] ^-- substep ok [2015-07-08 14:15:02,726: debug/mainprocess] | consumer: starting events [2015-07-08 14:15:02,762: debug/mainprocess] start server, version: 0.9, properties: {u'information': u'licensed under mpl.  see http://www.rabbitmq.com/', u'product': u'rabbitmq', u'copyrigh t': u'copyright (c) 2007-2014 gopivotal, inc.', u'capabilities': {u'exchange_exchange_bindings': true, u'connection.blocked': true, u'authentication_failure_close': true, u'basic.nack': true, u'per_co nsumer_qos': true, u'consumer_priorities': true, u'consumer_cancel_notify': true, u'publisher_confirms': true}, u'cluster_name': u'rabbit@ophir-pc', u'platform': u'erlang/otp', u'version': u'3.5.3'}, mechanisms: [u'amqplain', u'plain'], locales: [u'en_us'] [2015-07-08 14:15:02,776: debug/mainprocess] open ok! [2015-07-08 14:15:02,778: debug/mainprocess] using channel_id: 1 [2015-07-08 14:15:02,779: debug/mainprocess] channel open [2015-07-08 14:15:02,780: debug/mainprocess] ^-- substep ok [2015-07-08 14:15:02,780: debug/mainprocess] | consumer: starting mingle [2015-07-08 14:15:02,782: info/mainprocess] mingle: searching neighbors [2015-07-08 14:15:02,782: debug/mainprocess] using channel_id: 1 [2015-07-08 14:15:02,790: debug/mainprocess] channel open [2015-07-08 14:15:03,802: info/mainprocess] mingle: alone [2015-07-08 14:15:03,802: debug/mainprocess] ^-- substep ok [2015-07-08 14:15:03,803: debug/mainprocess] | consumer: starting tasks [2015-07-08 14:15:03,808: debug/mainprocess] ^-- substep ok [2015-07-08 14:15:03,809: debug/mainprocess] | consumer: starting control [2015-07-08 14:15:03,809: debug/mainprocess] using channel_id: 2 [2015-07-08 14:15:03,811: debug/mainprocess] channel open [2015-07-08 14:15:03,816: debug/mainprocess] ^-- substep ok [2015-07-08 14:15:03,818: debug/mainprocess] | consumer: starting heart [2015-07-08 14:15:03,819: debug/mainprocess] ^-- substep ok [2015-07-08 14:15:03,819: debug/mainprocess] | consumer: starting gossip [2015-07-08 14:15:03,821: debug/mainprocess] using channel_id: 3 [2015-07-08 14:15:03,822: debug/mainprocess] channel open [2015-07-08 14:15:03,832: debug/mainprocess] ^-- substep ok [2015-07-08 14:15:03,832: debug/mainprocess] | consumer: starting event loop [2015-07-08 14:15:03,834: warning/mainprocess] celery@ophir-pc ready. [2015-07-08 14:15:03,834: debug/mainprocess] basic.qos: prefetch_count->16 [2015-07-08 14:15:03,835: info/mainprocess] received task: celery_test.service.operation[f3ed8b0e-009d-4fad-8cec-1c7b1d1e5797] [2015-07-08 14:15:03,835: debug/mainprocess] taskpool: apply <function _fast_trace_task @ 0x000000000404f208> (args:('celery_test.service.operation', 'f3ed8b0e-009d-4fad-8cec-1c7b1d1e5797', ('foo',),  {}, {'timelimit': (none, none), 'utc': true, u'is_eager': false, 'chord': none, u'group': none, 'args': ('foo',), 'retries': 0, u'delivery_info': {u'priority': none, u'redelivered': false, u'routing_ key': u'celery', u'exchange': u'celery'}, 'expires': none, u'hostname': 'celery@ophir-pc', 'task': 'celery_test.service.operation', 'callbacks': none, u'correlation_id': u'f3ed8b0e-009d-4fad-8cec-1c7b 1d1e5797', 'errbacks': none, u'reply_to': u'f1fa5ace-0038-3058-93da-6ed2d6b5e752', 'taskset': none, 'kwargs': {}, 'eta': none, 'id': 'f3ed8b0e-009d-4fad-8cec-1c7b1d1e5797', u'headers': {}}) kwargs:{})  [2015-07-08 14:15:03,835: info/worker-1] foo [2015-07-08 14:15:03,838: debug/mainprocess] task accepted: celery_test.service.operation[f3ed8b0e-009d-4fad-8cec-1c7b1d1e5797] pid:10188 [2015-07-08 14:15:03,839: info/mainprocess] task celery_test.service.operation[f3ed8b0e-009d-4fad-8cec-1c7b1d1e5797] succeeded in 0.00399994850159s: 1 [2015-07-08 14:15:07,926: debug/mainprocess] pidbox received method enable_events() [reply_to:none ticket:none] [2015-07-08 14:15:07,927: info/mainprocess] events of group {task} enabled remote. [2015-07-08 14:15:12,918: debug/mainprocess] pidbox received method enable_events() [reply_to:none ticket:none] 

i tried amqp backend, , there no changes.

apparently it's known issue on windows

there's open ticket: https://github.com/celery/celery/issues/897

and workaround - specify pool=solo when starting worker:

celery -a celery_test.service worker --loglevel=debug --pool=solo 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -