Skip to content

Commit

Permalink
Merge 91948ef into db2caf5
Browse files Browse the repository at this point in the history
  • Loading branch information
buckensl committed Apr 24, 2015
2 parents db2caf5 + 91948ef commit eb049b9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions celery/backends/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ def encode(self, data):
return data
return super(MongoBackend, self).encode(data)

def decode_result(self, payload):
meta = self.decode(payload)
if meta['status'] in self.EXCEPTION_STATES:
meta['result'] = self.exception_to_python(meta['result'])
return meta

def decode(self, data):
if self.serializer == 'bson':
return data
Expand Down Expand Up @@ -208,7 +214,7 @@ def _get_task_meta_for(self, task_id):
return self.meta_from_decoded({
'task_id': obj['_id'],
'status': obj['status'],
'result': self.decode(obj['result']),
'result': self.decode_result(obj['result']),
'date_done': obj['date_done'],
'traceback': self.decode(obj['traceback']),
'children': self.decode(obj['children']),
Expand All @@ -232,7 +238,7 @@ def _restore_group(self, group_id):
obj = self.group_collection.find_one({'_id': group_id})
if obj:
tasks = [self.app.AsyncResult(task)
for task in self.decode(obj['result'])]
for task in self.decode_result(obj['result'])]

return {
'task_id': obj['_id'],
Expand Down

0 comments on commit eb049b9

Please sign in to comment.