title: How to get all tasks and periodic tasks in Celery
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3862310/how-can-i-find-all-subclasses-of-a-given-class-in-python">How can I find all subclasses of a given class in Python?</a>  </p>
  </blockquote>
  
  
  
  <p>In my Django project, I have some subclass of Celery's <code>Task</code> and <code>PeriodicTask</code>:</p>
  
  <pre><code>class CustomTask(Task):
      # stuff
  
  class CustomPeriodicTask(PeriodicTask):
      # stuff
  </code></pre>
  
  <p>I need all Task classes to add some custom logging configuration. So I thought I can us <code>__subclasses__</code>, but this does not work:</p>
  
  <pre><code>&gt;&gt;&gt; Task.__subclasses__()
  [&lt;unbound PeriodicTask&gt;, &lt;class handle_register of &lt;Celery default:0xa1cc3cc&gt;&gt;]
  </code></pre>
  
  <p>Is it somehow possible to get all my <code>Task</code> and <code>PeriodicTask</code> subclasses in a dynamic way?</p>