Reputation: 67
I got a task to make exports of several big tables in DB asynchronous because right now the amount of records is so big that it takes too much time. So I've successfully moved the code of exporting to the Celery task. It exports and saves the file in a folder on a server. But I am not able to get from the task the whole filename, which I could pass to the rest of code and therefore download it after completing the export process because the only thing Celery task can return is only the state of the result of performing the task (done or not yet or failed). I am using Django/Python + Celery + Redis. Thank you for any advice, it already borders me for several days.
Upvotes: 1
Views: 561
Reputation: 67
After helping comment from Danila, I have tried celery.result library, which I didnt know anything about before (surprisingly I also havent found any mention of it before). After importing ResultBase from celery.result, which captures the incoming results from task, I was finally able to get the URL of my generated file and therefore I got what I needed. Thank you
Upvotes: 1