sbose
sbose

Reputation: 1811

Celery result backend stores a encoded string in result column

After I run an async task

tasks.add.apply_async( (10, 10))

I checked the result backends database table celery_taskmeta and noticed the result containing something like gAJLBC4=

I couldn't find in the docs what that result implies and whether I can store the actual result of the function call ( ie, the return value ) in the table as is.

For this instance where I am executing a task which adds two numbers : 10 and 10 , the result column in celery_taskmeta should have 20 as per my understanding ( which is probably wrong ) .

How should I achieve that ?

I'm assuming that result is also serialized? I'm using a redis broker and not clear which configuration I need to set to be able to retrieve the actual return value.

Upvotes: 2

Views: 1484

Answers (1)

scytale
scytale

Reputation: 12641

the best way to get the result is not to query the database directly and instead to use the result api

result = tasks.add.apply_async( (10, 10))
result.ready
> True
result.result
> 20

Upvotes: 1

Related Questions