title: Celery worker variable sharing issues
body: <p>I am using Python and <a href="http://www.celeryproject.org" rel="nofollow">celery</a> in a project. In the project, I have two files:</p>
  
  <p><strong>celeryconfig.py</strong></p>
  
  <pre><code>BROKER_URL = "amqp://guest:guest@localhost:5672//"
  CELERY_RESULT_BACKEND = "amqp"
  CELERY_IMPORTS = ("example",)
  CELERYD_CONCURRENCY = 2
  </code></pre>
  
  <p>and <strong>example.py</strong></p>
  
  <pre><code>from celery.task import task
  import hashlib
  
  md5 = hashlib.md5()
  
  @task
  def getDigest(text):
      print 'Using md5 - ',md5
      md5.update(text)
      return md5.digest()
  </code></pre>
  
  <p>In <strong>celeryconfig.py</strong>, I set the <strong>CELERYD_CONCURRENCY</strong> to <em>2</em>, which means that it will distribute the tasks in my task queue to <em>2</em> different processes. </p>
  
  <p>From a Python console, I run:</p>
  
  <pre><code>from example import getDigest
  getDigest.delay('foo');getDigest.delay('bar')
  </code></pre>
  
  <p>This creates two tasks that are simultaneously executed by the two workers.
  The problem is, as both of the worker processes run their task functions [<strong>getDigest()</strong>], they seem to be using the same hash object (<strong>md5</strong>). The output of <strong>celeryd</strong> confirms this as you can see below.</p>
  
  <pre><code>[PoolWorker-2] Using md5 -
  [PoolWorker-2] &lt;md5 HASH object @ 0x23e6870&gt;
  [PoolWorker-1] Using md5 -
  [PoolWorker-1] &lt;md5 HASH object @ 0x23e6870&gt;
  </code></pre>
  
  <p>For the sake of simplicity, I am using the md5 object of hashlib, but in my actual project, I am using an object that <strong>cannot</strong> be accessed and modified by more than one process. This  expectedly makes the workers crash. </p>
  
  <p>That brings up the question: How can I modify my code to make the worker processes initialize and use their very own (<strong>md5</strong>) object? Right now, they are sharing the same object - causing my application to crash. Is this possible?</p>