[Python] Is there an alternative to ask every n seconds to know if a celery task is done?

Discussão em 'Python' iniciado por Stack, Maio 20, 2025.

  1. Stack

    Stack Membro Participativo

    I used Celery several times in the past and the idea I always had is that:

    • You have a FastAPI, which delays tasks connecting to a broker
    • Celery gets the tasks, do them and then sends back the result to the broker.
    • In the fastAPI you have an endpoint to check using AsyncResult the result of a given task id, which you call every N seconds.

    However, in my current application I was asked to use Redis, and let the team that had to send me the calls to my FastAPI deliver directly their messages in Redis, so we avoid using the FastAPI in the middle. I have already done this, I know how they have to write the messages in Redis. Nontheless, we still have the question about how to ping them that the results we have are already done. Is there any alternative than asking every N seconds? I was thining they might send me an ID and I had to ping them with that ID, but they were asing something about using redis streams. I'm connecting using "rediss", but tasks are given to redis lists, and results are Redis strings.

    Continue reading...

Compartilhe esta Página