pypiexception95% confidence\u2191 39

Why does Celery NOT throw an Exception when the underlying task throws one

Full error message
Celery doesn't seem to be handling exceptions properly.  

If I have task:

def errorTest():
    raise Exception()

and then I call

r = errorTest.delay()
In [8]: r.result

In [9]: r.state
Out[9]: 'PENDING'

And it will hang like this indefinitely.  

Going and checking the logs shows that the error IS getting thrown in the task (and if you want the message, ask), and I know that the backend and everything is set up properly because other tasks just work and return results correctly.  

Is there something funky that I need to do to catch exceptions in Celery?

/Celery version is 3.0.13, broker is RabbitMQ running on my local machine

You can define an on_failure function in your Task subclass to handle them correctly. If you're just looking to find out what happened you can setup error email notifications that will send you the stack trace in your celery config. Note: As of v4 Celery no longer supports sending emails.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/ce44cf6604a3a555683c2db5cee82208e6cd89e53f9b02c16396dd78ec4c1a44
hash \u00b7 ce44cf6604a3a555683c2db5cee82208e6cd89e53f9b02c16396dd78ec4c1a44
Why does Celery NOT throw an Exception when the underlying t… — DepScope fix | DepScope