title: Celery and transaction.atomic
body: <p>In some Django views, I used a pattern like this to save changes to a model, and then to do some asynchronous updating (such as generating images, further altering the model) based on the new model data.  <code>mytask</code> is a celery task:</p>
  
  <pre><code>with transaction.atomic():
      mymodel.save()
      mytask.delay(mymodel.id).get()
  </code></pre>
  
  <p>The problem is that the task never returns.  Looking at celery's logs, the task gets queued (I see "Received task" in the log), but it never completes.  If I move the <code>mytask.delay...get</code> call out of the transaction, it completes successfully.</p>
  
  <p>Is there some incompatibility between <code>transaction.atomic</code> and celery?  Is it possible in Django 1.6 or 1.7 for me to have both regular model updates and updates from a separate task process under one transaction?</p>
  
  <p>My database is postgresql 9.1.  I'm using celery==3.1.16 / django-celery 3.1.16, amqp==1.4.6, Django==1.6.7, kombu==3.0.23.  The broker backend is amqp, and rabitmq as the queue.</p>