Reputation: 5017
I am trying to save and restore GroupResult object after running task in Celery. The group result ID is returned and saved as expected. When I am trying to restore GroupResult with it:
from project.celery import app
print(smstask.celery_result_id)
print(app.GroupResult.restore(smstask.celery_result_id))
I get (as example):
4780fc17-44d8-478f-a41a-e4333aaa03d4
None
For the Celery backend I am using Djcelery. Can it be the cause of the problem? CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend'
What else can you recommend to try? Thank you!
Upvotes: 0
Views: 1151
Reputation: 1937
You should save()
GroupResult
if you have plan to use it later.
Then you can restore it by providing GroupResult.id to restore()
method:
from celery import group, result
from app.tasks import foo, bar
group_result = group([foo.s(), bar.s()])()
group_result.save()
restored_group_result = result.GroupResult.restore(group_result.id)
print(restored_group_result)
Upvotes: 1