I want to know if there is a way to monitor whether or not a task completes or fails as soon as it does using python celery. I have an event I want to fire up based on the results of a certain task.
You can run your task as a celery @shared_task
with a try except
block inside:
@shared_task
def my_task(input1, input2, ...):
Setting up...
try:
Do stuff
fire_success_event() <- Your success event
except Exception:
The above stuff failed
fire_fail_event() <- your fail event
return 1 <- fail
return 0 <- success
Good luck :)