I have celery app with Redis as broker.
The code consist of the following in a loop :
running = []
res = add.apply_async([1,2], queue='add')
running.append(res)
while running:
r = running.pop()
if r.ready():
print r.get()
else:
running.insert(0,r)
everything works fine but when i redis-cli
into redis and execute keys *
I see bunch of celery-task-meta keys.
Why arent they cleaned up?
What are those for?
--
[EDIT]
I've read about CELERY_TASK_RESULT_EXPIRES setting.
Is it possible for the task keys in Redis to be cleaned up right after the result is read rather than wait until the expiration time?
From the Celery Doc:
AsyncResult.forget()
Forget about (and possibly remove the result of) this task.
You have to first r.get()
then r.forget()
But, You needn't cleaned up the keys. For,doc say that:
CELERY_TASK_RESULT_EXPIRES
Default is to expire after 1 day.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With