我正在使用django-celery并进行了设置,这样我就可以从交互式shell调用一个任务,任务完成(由celery日志证明),并且我可以在celeryd输出中看到结果。
然而,我似乎永远无法在我开始任务的shell中获得任务的结果:
>>> from mymodule.tasks import testTask
>>> res = testTask.delay()
>>> testTask.ready()
False
@task
def testTask():
logger.info('LOGGER: start task')
time.sleep(10)
logger.info('LOGGER: stop task')
return 5 我假设这是由于我有时会遇到以下错误:
TxIsolationWarning: Polling results with transaction isolation level repeatable-read within the same transaction may give outdated results. Be sure to commit the transaction for each poll iteration.我的问题是,我如何提交事务,在哪里完成?另外,这里的问题是什么?芹菜试图访问mysql的信息,而Django已经锁定了表?
提前谢谢你,
发布于 2013-07-10 15:41:23
如果您使用MySQL作为代理,请检查事务隔离级别。
http://docs.celeryproject.org/en/latest/faq.html#mysql-is-throwing-deadlock-errors-what-can-i-do
https://stackoverflow.com/questions/17553278
复制相似问题