My task goes into celery and gets results. I know this because I can do this.
>>> ts = TaskState.objects.all()[0]
>>> ts
Out[31]: <TaskState: SUCCESS apps.checklist.tasks.bulk_checklist_process(ec01461b-3431-478d-adfc-6d6cf162e9ad) ts:2012-07-20 14:35:41>
>>> ts.state
Out[32]: u'SUCCESS'
>>> ts.result
Out[33]: u'{\'info\': ["Great",]}'
But when I attempt to use the documented way to get the result - all hell breaks loose..
>>> from celery.result import BaseAsyncResult
>>> result = BaseAsyncResult(ts.task_id)
>>> result.get()
../lib/python2.7/site-packages/djcelery/managers.py:178: 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.
"Polling results with transaction isolation level "
So I have two questions.
- What am I missing in my setup of celery that is causing this error. I clearly have the results but BaseAsyncResult is jacked up. I don't even know where to look for this?
- Ignoring 1 for a sec it looks like as long as I have
ts.state == SUCCESS
I can just run with thets.result
. What would be the drawback to that and what format is that result in?
Update
So the second part is easy. Scary but easy..
context['results'] = resulting_values = result.get(propagate=False)
if not isinstance(resulting_values, dict):
context['results'] = resulting_values = eval(context['task'].result)
log.error("We should not be here..")