Skip to content

Commit 47c9513

Browse files
fillipoliquidpele
authored andcommitted
Docs/beat first use instructions (celery#89)
* Add details on running beat service for first time * Fix typo
1 parent 1b3789d commit 47c9513

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

README.rst

+40
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,46 @@ You can use the ``enabled`` flag to temporarily disable a periodic task::
192192
>>> periodic_task.enabled = False
193193
>>> periodic_task.save()
194194

195+
196+
Example running periodic tasks
197+
-----------------------------------
198+
199+
The periodic tasks still need 'workers' to execute them.
200+
So make sure the default **Celery** package is installed.
201+
(If not installed, please follow the installation instructions
202+
here: https://github.com/celery/celery)
203+
204+
Both the worker and beat services need to be running at the same time.
205+
206+
1. Start a Celery worker service (specify your Django project name)::
207+
208+
209+
$ celery -A [project-name] worker --loglevel=info
210+
211+
212+
2. As a separate process, start the beat service (specify the Django scheduler)::
213+
214+
215+
$ celery -A [project-name] beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
216+
217+
218+
**OR** you can use the -S (scheduler flag), for more options see ``celery beat --help ``)::
219+
220+
$ celery -A [project-name] beat -l info -S django
221+
222+
223+
Also, as an alternative, you can run the two steps above (worker and beat services)
224+
with only one command (recommended for **development environment only**)::
225+
226+
227+
$ celery -A [project-name] worker --beat --scheduler django --loglevel=info
228+
229+
230+
3. Now you can add and manage your periodic tasks from the Django Admin interface.
231+
232+
233+
234+
195235
Installation
196236
============
197237

docs/includes/introduction.txt

+37
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,40 @@ You can use the ``enabled`` flag to temporarily disable a periodic task::
183183

184184
>>> periodic_task.enabled = False
185185
>>> periodic_task.save()
186+
187+
188+
Example running periodic tasks
189+
-----------------------------------
190+
191+
The periodic tasks still need 'workers' to execute them.
192+
So make sure the default **Celery** package is installed.
193+
(If not installed, please follow the installation instructions
194+
here: https://github.com/celery/celery)
195+
196+
Both the worker and beat services need to be running at the same time.
197+
198+
1. Start a Celery worker service (specify your Django project name)::
199+
200+
201+
$ celery -A [project-name] worker --loglevel=info
202+
203+
204+
2. As a separate process, start the beat service (specify the Django scheduler)::
205+
206+
207+
$ celery -A [project-name] beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
208+
209+
210+
**OR** you can use the -S (scheduler flag), for more options see ``celery beat --help ``)::
211+
212+
$ celery -A [project-name] beat -l info -S django
213+
214+
215+
Also, as an alternative, you can run the two steps above (worker and beat services)
216+
with only one command (recommended for **development environment only**)::
217+
218+
219+
$ celery -A [project-name] worker --beat --scheduler django --loglevel=info
220+
221+
222+
3. Now you can add and manage your periodic tasks from the Django Admin interface.

0 commit comments

Comments
 (0)