title: How to execute independent tasks sequentially using Celery?
body: <p>I have to schedule some tasks which seem very complex to run in parallel. They do not depend on the result of each other and the function expects 3 arguments.</p>
  
  <p>I already tried using chain, map and starmap methods. With chain I get this error:</p>
  
  <pre><code>[2019-04-23 15:28:00,991: ERROR/PoolWorker-3] Task proj.apps.tasks.generate[112a7426-5ac3-4cd6-8416-5591c3c018a3] raised unexpected: TypeError('get expected at least 1 arguments, got 0',)
  Traceback (most recent call last):
    File ".../local/lib/python2.7/site-packages/celery/app/trace.py", line 367, in trace_task
      R = retval = fun(*args, **kwargs)
    File ".../local/lib/python2.7/site-packages/celery/app/trace.py", line 622, in __protected_call__
      return self.run(*args, **kwargs)
    File ".../tasks.py", line 966, in generate
      return res.get()
  TypeError: get expected at least 1 arguments, got 0
  </code></pre>
  
  <p>Using <code>map</code> I cannot pass all the arguments and with <code>starmap</code> all the tasks are started simultaneously. </p>
  
  <pre><code>[2019-04-23 15:48:00,991: INFO/MainProcess] Received task: generate[..]
  [2019-04-23 15:48:00,991: INFO/MainProcess] Received task: generate[..]
  [2019-04-23 15:48:00,991: INFO/MainProcess] Received task: generate[..]
  </code></pre>
  
  <p>An example of the task:</p>
  
  <pre class="lang-py prettyprint-override"><code>@shared_task
  def generate(field1, field2, field3=None):
     if field3 is not None:
        return field1 + field2 + field3
     return field1 + field2
  </code></pre>
  
  <p>Code using chain:</p>
  
  <pre><code>res = chain(generate.s(i, 5, j) for i in array1 for j in array2)
  return res.get()
  </code></pre>
  
  <p>Code using starmap:</p>
  
  <pre><code>arguments = [(i, 4, j) for i in array1 for j in array2]
  ~generate.starmap(arguments)
  </code></pre>