need to restart python while applying Celery config

我怕爱的太早我们不能终老 提交于 2019-12-13 07:03:13

问题


That's a small story...

I had this error:

AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for'

When changed tasks.py, like Diederik said at Celery with RabbitMQ: AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for'

app = Celery('tasks', backend='rpc://', broker='amqp://guest@localhost//')

ran it

>>> from tasks import add
>>> result = add.delay(4,50)
>>> result.ready()

got DisabledBackend again ... hmm what was that..

put code to file run.py and it returned True...

from tasks import add
try:
        result = add.delay(1,4)
        print (result.ready())
except:
        print "exept"

I see that if I call >>> from tasks import add after tasks.py changed, it doesn't get the updates... That behaviour is the same for ipython, so because of I can't understand the reason, I advice people to DEBUG from scripts like ~runthis.py

Will be glad for answer which will smash my idea...


回答1:


If using the interpreter, you need to

reload(tasks)

this will force reimport tasks module



来源:https://stackoverflow.com/questions/39998083/need-to-restart-python-while-applying-celery-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!