| > Use celery immediately if you have any "long lived" tasks such as email Hey, quick question from a relative newbie who is currently trying to solve this exact problem. Besides Celery, what are good options for handling long-running requests with Django? I see 3 options: - Use Celery or django Q to offload processing to worker nodes (how do you deliver results from the worker node back to the FE client?) - Use a library called django channels that I think supports all sorts of non-trivial use cases (jobs, websockets, long polling). - Convert sync Django to use ASGI and async views and run it using uvicorn. This option is super convoluted based on this talk [0], because you have to ensure all middleware supports ASGI, and because the ORM is sync-only, so seems like very easy to shoot yourself in the foot. The added complication, like I mentioned, is that my long-running requests need to return data back to the client in the browser. Not sure how to make it happen yet -- using a websocket connection, or long polling? Sorry I am ambushing you randomly in the comments like this, but it sounds like you know Django well so maybe you have some insights. --- [0] Async Django by Ivaylo Donchev
https://www.youtube.com/watch?v=UJzjdJGS1BM |
Celery is mature, but has bitten me more than anything else.
For scheduling, there are many libraries, but it's good to keep this separate from Celery IMO.
For background tasks, I think rolling your own solution (using a communication channel and method tailored to your needs) is the way to go. I really do at this point.
It definitive is not using async, I think that will bite you and not be worth the effort.
Huey is worth a look.