Skip to content

Commit

Permalink
Mention time zones in the periodic task guide
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Aug 29, 2012
1 parent 02656d7 commit d0e2c5d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/userguide/periodic-tasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,38 @@ at a time, otherwise you would end up with duplicate tasks. Using
a centralized approach means the schedule does not have to be synchronized,
and the service can operate without using locks.

.. _beat-timezones:

Time Zones
==========

The periodic task schedules uses the UTC time zone by default,
but you can change the time zone used using the :setting:`CELERY_TIMEZONE`
setting.

If you use a time zone other than UTC it's recommended to install the
:mod:`pytz` library as this can improve the accuracy and keep your timezone
specifications up to date:

.. code-block:: bash
$ pip install -U pytz
An example time zone could be `Europe/London`:

.. code-block:: python
CELERY_TIMEZONE = 'Europe/London'
.. admonition:: Changing the time zone

The default scheduler (storing the schedule in the :file:`celerybeat-schedule`
file) will automatically detect that the timezone has changed, and so will
reset the schedule itself, but other schedulers may not be so smart (e.g. the
Django database scheduler) and in that case you will have to reset the
schedule manually.

.. _beat-entries:

Entries
Expand All @@ -44,6 +76,8 @@ Example: Run the `tasks.add` task every 30 seconds.
},
}
CELERY_TIMEZONE = 'UTC'
Using a :class:`~datetime.timedelta` for the schedule means the task will
be executed 30 seconds after `celery beat` starts, and then every 30 seconds
Expand Down

0 comments on commit d0e2c5d

Please sign in to comment.