Pārlūkot izejas kodu

Fix Exception marshalling with JSON serializer

The code in `drain_events` in `amqp.py` naively sets the result dict
to a plain meta dict without transforming the dict structure back into
an actual Exception through `exception_to_python`.

When a task raises an exception, `AsyncResult.get` tries to raise the
exception, which is actually still a dict and fails with:

```
TypeError: exceptions must be old-style classes or derived from
BaseException, not dict
```

This patch makes `drain_events` call `meta_from_decoded` which is
responsible for that, just like it is called in `get_many`. Then,
raising the exception in `AsyncResult.get` works fine.

To reproduce, see the testcase in #2518. Then, apply the patch and see
stuff start to work again.

closes #2518
Allard Hoeve 10 gadi atpakaļ
vecāks
revīzija
1a81eb716e
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      celery/backends/amqp.py

+ 1 - 1
celery/backends/amqp.py

@@ -200,7 +200,7 @@ class AMQPBackend(BaseBackend):
 
         def callback(meta, message):
             if meta['status'] in states.READY_STATES:
-                results[meta['task_id']] = meta
+                results[meta['task_id']] = self.meta_from_decoded(meta)
 
         consumer.callbacks[:] = [callback]
         time_start = now()