title: Celery Result error "args must be a list or tuple"
body: <p>I am running a Django website and have just gotten Celery to run, but I am getting confusing errors. Here is how the code is structured.</p>
  
  <p>In tests.py:</p>
  
  <pre><code>from tasks import *
  from celery.result import AsyncResult
  
  project = Project.objects.create()
  # initalize various sub-objects of the project
  
  c = function.delay(project.id)
  r = AsyncResult(c.id).ready()
  f = AsyncResult(c.id).failed()
  # wait until the task is done  
  while not r and not f:
      r = AsyncResult(c.id).ready()
      f = AsyncResult(c.id).failed()
  
  self.assertEqual() #will fail because task fails
  </code></pre>
  
  <p>in tasks.py:  </p>
  
  <pre><code>from __future__ import absolute_import
  from celery import shared_task
  
  @shared_task
  def function(project_id)
      #a bunch of calculations followed by a save of the project
      project = Project.objects.get(project=project_id)
  
      for part in project.part_set.all():
          partFunction(part.id)
          p = Part.objects.get(id=part.id)
          # add to various variables in project from variables in p
      project.save()
  </code></pre>
  
  <p>in mainapp/settings.py:</p>
  
  <pre><code>BROKER_URL = "amqp://ipaddress"
  CELERY_RESULT_BACKEND='amqp'
  CELERY_ACCEPT_CONTENT = ['json','pickle','msgpack','yaml']
  CELERY_IGNORE_RESULT = False
  </code></pre>
  
  <p>the celery debug console log for must by list/tuple:</p>
  
  <pre><code>[INFO/MainProcess] Received task: myapp.tasks.function[id]
  [ERROR/MainProcess] Task myapp.tasks.function[id]
      raised unexpected: ValueError('task args must be a list or tuple',)
  Traceback:
     File "/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
         R = retval = fun(*args, **kwargs)
     File "/python2.7/site-packages/celery/app/trace.py", line 437, in __protected_call__
         return self.run(*args, **kwargs)
     File "/myapp/tasks.py", line 28, in function
         p = Part.objects.get(id=part.id)
     File "/python2.7/site-packages/celery/app/task.py", line 555, in apply_async
         **dict(self._get_exec_options(), **options)
     File "/python2.7/site-packages/celery/app/base.py", line 351, in send_task
         reply_to=reply_to or self.oid, **options
     File "celery/app/amqp.py", line 252, in publish_task
         raise ValueError('task args must be a list or tuple')
  ValueError: task args must be a list or tuple
  </code></pre>
  
  <p>the error I am getting is as above, <code>AsyncResult(c.id).result: task args must be a list or tuple</code>. This should be an easy solution but it is not. When I make it a list like so:</p>
  
  <pre><code>inline = [project.id]
  c = function.delay(inline)
  </code></pre>
  
  <p>It then changes it mind and tells me that <code>AsyncResult(c.id).result: int() argument must be a string or a number, not 'list'</code></p>
  
  <p>As you can imagine I am very confused as to what might be the problem.</p>
  
  <hr>
  
  <h2>Edit</h2>
  
  <p>tasks.py</p>
  
  <pre><code>@shared_task
  def function(app):
      @app.task(name='myapp.function', bind=True)
      def function(project_id):
  </code></pre>
  
  <p>tests.py</p>
  
  <pre><code>c = function.s(project.id).delay()
  </code></pre>
  
  <p>function.app prints </p>