title: How to get the "full" async result in Celery link_error callback
body: <p>I have Celery 3.1.18 running with Django 1.6.11 and RabbitMQ 3.5.4, and trying to test my async task in a failure state (CELERY_ALWAYS_EAGER=True). However, I cannot get the proper "result" in the error callback. The example in the <a href="http://docs.celeryproject.org/en/latest/userguide/calling.html#linking-callbacks-errbacks" rel="nofollow">Celery docs</a> shows:</p>
  
  <pre><code>@app.task(bind=True)
  def error_handler(self, uuid):
      result = self.app.AsyncResult(uuid)
      print('Task {0} raised exception: {1!r}\n{2!r}'.format(
            uuid, result.result, result.traceback))
  </code></pre>
  
  <p>When I do this, my result is still "PENDING", <code>result.result = ''</code>, and <code>result.traceback=''</code>. But the actual result returned by my <code>.apply_async</code> call has the right "FAILURE" state and traceback.</p>
  
  <p>My code (basically a Django Rest Framework RESTful endpoint that parses a .tar.gz file, and then sends a notification back to the user, when the file is done parsing):</p>
  
  <p>views.py:</p>
  
  <pre><code>from producer_main.celery import app as celery_app
  
  @celery_app.task()
  def _upload_error_simple(uuid):
      print uuid
      result = celery_app.AsyncResult(uuid)
      print result.backend
      print result.state
      print result.result
      print result.traceback
      msg = 'Task {0} raised exception: {1!r}\n{2!r}'.format(uuid,
                                                             result.result,
                                                             result.traceback)
  
  
  class UploadNewFile(APIView):
      def post(self, request, repository_id, format=None):
          try:    
              uploaded_file = self.data['files'][self.data['files'].keys()[0]]
              self.path = default_storage.save('{0}/{1}'.format(settings.MEDIA_ROOT,
                                                                uploaded_file.name),
                                               uploaded_file)
              print type(import_file)
              self.async_result = import_file.apply_async((self.path,  request.user),
                                                          link_error=_upload_error_simple.s())
  
  
              print 'results from self.async_result:'
              print self.async_result.id
              print self.async_result.backend
              print self.async_result.state
              print self.async_result.result
              print self.async_result.traceback
              return Response()
          except (PermissionDenied, InvalidArgument, NotFound, KeyError) as ex:
              gutils.handle_exceptions(ex)
  </code></pre>
  
  <p>tasks.py:</p>
  
  <pre><code>from producer_main.celery import app
  from utilities.general import upload_class
  
  
  @app.task
  def import_file(path, user):
      """Asynchronously import a course."""
      upload_class(path, user)
  </code></pre>
  
  <p>celery.py:</p>
  
  <pre><code>"""
  As described in
  http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
  """
  from __future__ import absolute_import
  
  import os
  import logging
  
  from celery import Celery
  
  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'producer_main.settings')
  
  from django.conf import settings
  
  log = logging.getLogger(__name__)
  
  app = Celery('producer')  # pylint: disable=invalid-name
  
  # Using a string here means the worker will not have to
  # pickle the object when using Windows.
  app.config_from_object('django.conf:settings')
  app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)  # pragma: no cover
  
  @app.task(bind=True)
  def debug_task(self):
      print('Request: {0!r}'.format(self.request))
  </code></pre>
  
  <p>My backend is configured as such:</p>
  
  <pre><code>CELERY_ALWAYS_EAGER = True
  CELERY_EAGER_PROPAGATES_EXCEPTIONS = False
  BROKER_URL = 'amqp://'
  CELERY_RESULT_BACKEND = 'redis://localhost'
  CELERY_RESULT_PERSISTENT = True
  CELERY_IGNORE_RESULT = False
  </code></pre>
  
  <p>When I run my unittest for the link_error state, I get:</p>
  
  <pre><code>Creating test database for alias 'default'...
  &lt;class 'celery.local.PromiseProxy'&gt;
  130ccf13-c2a0-4bde-8d49-e17eeb1b0115
  &lt;celery.backends.redis.RedisBackend object at 0x10aa2e110&gt;
  PENDING
  None
  None
  results from self.async_result:
  130ccf13-c2a0-4bde-8d49-e17eeb1b0115
  None
  FAILURE
  Non .zip / .tar.gz file passed in.
  Traceback (most recent call last):
  </code></pre>
  
  <p>So the task results are not available in my <code>_upload_error_simple()</code> method, but they are available from the <code>self.async_result</code> returned variable...</p>