Преглед изворни кода

Remove references to register in documentation

Ask Solem пре 16 година
родитељ
комит
9b63529e25
4 измењених фајлова са 1 додато и 12 уклоњено
  1. 0 4
      README.rst
  2. 0 2
      docs/cookbook/tasks.rst
  3. 0 2
      docs/slidesource/slide-example1.py
  4. 1 4
      docs/tutorials/clickcounter.rst

+ 0 - 4
README.rst

@@ -267,13 +267,11 @@ This is a task that basically does nothing but take some arguments,
 and return a value:
 and return a value:
 
 
     >>> from celery.task import Task
     >>> from celery.task import Task
-    >>> from celery.registry import tasks
     >>> class MyTask(Task):
     >>> class MyTask(Task):
     ...     def run(self, some_arg, **kwargs):
     ...     def run(self, some_arg, **kwargs):
     ...         logger = self.get_logger(**kwargs)
     ...         logger = self.get_logger(**kwargs)
     ...         logger.info("Did something: %s" % some_arg)
     ...         logger.info("Did something: %s" % some_arg)
     ...         return 42
     ...         return 42
-    >>> tasks.register(MyTask)
 
 
 As you can see the worker is sending some keyword arguments to this task,
 As you can see the worker is sending some keyword arguments to this task,
 this is the default keyword arguments. A task can choose not to take these,
 this is the default keyword arguments. A task can choose not to take these,
@@ -358,7 +356,6 @@ Periodic tasks are tasks that are run every ``n`` seconds.
 Here's an example of a periodic task:
 Here's an example of a periodic task:
 
 
     >>> from celery.task import PeriodicTask
     >>> from celery.task import PeriodicTask
-    >>> from celery.registry import tasks
     >>> from datetime import timedelta
     >>> from datetime import timedelta
     >>> class MyPeriodicTask(PeriodicTask):
     >>> class MyPeriodicTask(PeriodicTask):
     ...     run_every = timedelta(seconds=30)
     ...     run_every = timedelta(seconds=30)
@@ -367,7 +364,6 @@ Here's an example of a periodic task:
     ...         logger = self.get_logger(**kwargs)
     ...         logger = self.get_logger(**kwargs)
     ...         logger.info("Running periodic task!")
     ...         logger.info("Running periodic task!")
     ...
     ...
-    >>> tasks.register(MyPeriodicTask)
 
 
 **Note:** Periodic tasks does not support arguments, as this doesn't
 **Note:** Periodic tasks does not support arguments, as this doesn't
 really make sense.
 really make sense.

+ 0 - 2
docs/cookbook/tasks.rst

@@ -23,7 +23,6 @@ The cache key expires after some time in case something unexpected happens
 .. code-block:: python
 .. code-block:: python
 
 
     from celery.task import Task
     from celery.task import Task
-    from celery.registry import tasks
     from django.core.cache import cache
     from django.core.cache import cache
     from django.utils.hashcompat import md5_constructor as md5
     from django.utils.hashcompat import md5_constructor as md5
     from djangofeeds.models import Feed
     from djangofeeds.models import Feed
@@ -61,4 +60,3 @@ The cache key expires after some time in case something unexpected happens
                 release_lock()
                 release_lock()
 
 
             return feed.url
             return feed.url
-    tasks.register(FeedImporter)

+ 0 - 2
docs/slidesource/slide-example1.py

@@ -1,9 +1,7 @@
 from celery.task import Task
 from celery.task import Task
-from celery.registry import tasks
 
 
 
 
 class MyTask(Task):
 class MyTask(Task):
 
 
     def run(self, x, y):
     def run(self, x, y):
         return x * y
         return x * y
-tasks.register(MyTask)

+ 1 - 4
docs/tutorials/clickcounter.rst

@@ -208,7 +208,6 @@ Processing the clicks every 30 minutes is easy using celery periodic tasks.
 .. code-block:: python
 .. code-block:: python
 
 
     from celery.task import PeriodicTask
     from celery.task import PeriodicTask
-    from celery.registry import tasks
     from clickmuncher.messaging import process_clicks
     from clickmuncher.messaging import process_clicks
     from datetime import timedelta
     from datetime import timedelta
 
 
@@ -218,12 +217,10 @@ Processing the clicks every 30 minutes is easy using celery periodic tasks.
     
     
         def run(self, \*\*kwargs):
         def run(self, \*\*kwargs):
             process_clicks()
             process_clicks()
-    tasks.register(ProcessClicksTask)
 
 
 We subclass from :class:`celery.task.base.PeriodicTask`, set the ``run_every``
 We subclass from :class:`celery.task.base.PeriodicTask`, set the ``run_every``
 attribute and in the body of the task just call the ``process_clicks``
 attribute and in the body of the task just call the ``process_clicks``
-function we wrote earlier. Finally, we register the task in the task registry
-so the celery workers is able to recognize and find it.
+function we wrote earlier. 
 
 
 
 
 Finishing
 Finishing