소스 검색

fixed documentation that still referenced original form of crontab PeriodicTask scheduling

Patrick Altman 15 년 전
부모
커밋
970a01c246
1개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 7 7
      docs/getting-started/periodic-tasks.rst

+ 7 - 7
docs/getting-started/periodic-tasks.rst

@@ -20,20 +20,20 @@ Here's an example of a periodic task:
     >>> tasks.register(MyPeriodicTask)
 
 If you want a little more control over when the task is executed, for example,
-a particular time of day or day of the week, you can subclass a ``ScheduledTask``:
+a particular time of day or day of the week, you can use ``crontab`` to set
+the ``run_every`` property:
 
 .. code-block:: python
 
-    from celery.task import ScheduledTask
+    from celery.task import PeriodicTask
+    from celery.task.schedules import crontab
 
-    class EveryMondayMorningTask(ScheduledTask):
-        hour = 7
-        minute = 30
-        day_of_week = 1
+    class EveryMondayMorningTask(PeriodicTask):
+        run_every = crontab(hour=7, minute=30, day_of_week=1)
 
         def run(self, **kwargs):
             logger = self.get_logger(**kwargs)
-            logger.info("This will execute every Monday at 7:30AM.")
+            logger.info("Execute every Monday at 7:30AM.")
 
 If you want to use periodic tasks you need to start the ``celerybeat``
 service. You have to make sure only one instance of this server is running at