I have a celery set up that uses two different servers to process tasks. I'm trying to figure out the best way to match which server the task completed on. I looked through the docs and didn't see anything about retrieving the hostname from an AsyncResult.
Any input on this matter is appreciated. Another option I was thinking of trying is simply putting the hostname within each celery config, although this method is not desired as it is one more thing to remember to do.
A possible workaround is returning the hostname with task return value
from celery import current_task
@celery.task
def hello(x, y):
return dict(hostname=current_task.request.hostname, result='hello')
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