title: django-celery: Dynamically create and register a task
body: <p>I'd like to add delaying of arbitrary tasks using <code>django-celery</code>. Currently, I have created a class similar to the one below (just an example, actual classes have more than this):</p>
  
  <pre><code>from celery.task import task
  
  class Delayer(object):
      def delay(self, func, minutes):
          return task(func, name="%s.delayed"%self.__class__.__name__)\
              .apply_async(countdown=minutes*60)
  </code></pre>
  
  <p>I'm running celeryd as follows:</p>
  
  <pre><code>python manage.py celeryd -E -B -lDEBUG
  </code></pre>
  
  <p>When I try running my delay method from within a django shell [eg <code>Delayer().delay(lambda: 1, 1)</code>], I'm getting an error like this in my celeryd output:</p>
  
  <pre><code>[2013-01-02 15:26:39,324: ERROR/MainProcess] Received unregistered task of type "Delayer.delayed".
  The message has been ignored and discarded.
  
  Did you remember to import the module containing this task?
  Or maybe you are using relative imports?
  Please see http://bit.ly/gLye1c for more information.
  
  The full contents of the message body was:
  {'retries': 0, 'task': "Delayer.delayed", 'eta': '2013-01-02T21:27:39.320913', 'args': [], 'expires': None, 'callbacks': None, 'errbacks': None, 'kwargs': {}, 'id': '99d49fa7-bd4b-40b0-80dc-57309a6f19b1', 'utc': True} (229b)
  
  Traceback (most recent call last):
    File "/home/simon/websites/envs/delayer/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 432, in on_task_received
      strategies[name](message, body, message.ack_log_error)
  KeyError: "Delayer.delayed"
  </code></pre>
  
  <p>My question is, is it possible to register such dynamically created tasks? If not, what other method can I use to achieve the same effect using celery?</p>