Browse Source

Documented celery.loaders.djangoapp

Ask Solem 15 years ago
parent
commit
731fdac4a5
1 changed files with 15 additions and 0 deletions
  1. 15 0
      celery/loaders/djangoapp.py

+ 15 - 0
celery/loaders/djangoapp.py

@@ -2,12 +2,20 @@ from celery.loaders.base import BaseLoader
 
 
 class Loader(BaseLoader):
+    """The Django loader."""
 
     def read_configuration(self):
+        """Load configuration from Django settings."""
         from django.conf import settings
         return settings
 
     def on_task_init(self, task_id, task):
+        """This method is called before a task is executed.
+        
+        Does everything necessary for Django to work in a long-living,
+        multiprocessing environment.
+        
+        """
         # See: http://groups.google.com/group/django-users/browse_thread/
         #       thread/78200863d0c07c6d/38402e76cf3233e8?hl=en&lnk=gst&
         #       q=multiprocessing#38402e76cf3233e8
@@ -30,5 +38,12 @@ class Loader(BaseLoader):
             cache.cache.close()
 
     def on_worker_init(self):
+        """Called when the worker starts.
+
+        Uses :func:`celery.discovery.autodiscover` to automatically discover
+        any ``tasks.py`` files in the applications listed in
+        ``INSTALLED_APPS``.
+
+        """
         from celery.discovery import autodiscover
         autodiscover()