I have a Django application that use Celery to create async tasks. Some of these tasks live within the Django project and other live on a remote worker with its own code base.
I currently use the django-celery-results
package to store the results of task calls within the Django database so that I can easily query the status of calls using the Django ORM. This works fine when I call my "local" tasks, but it does not seem to work as well when I call remote tasks.
For example:
app.send_task("django.foo") # Return status SUCCESS and store result in DB
app.send_task("remote.bar") # Stuck in PENDING and never create result in DB
By reading the Celery Docs I found out that tasks can be stuck in PENDING if the client and worker doesn't use the same CELERY_RESULT_BACKEND
setting. In this case I can't use the django-db
backend on my remote worker, since it's not a Django application.
So in this case... How do I store my results when doing remote calls in this manner?
Note that in the case of remote.bar
, I confirm that the remote worker receives the message and executes the method. Its just that my client (Django App) doesn't receive the response.