summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2020-05-23 13:51:26 +0300
committerAlex Grönholm <alex.gronholm@nextday.fi>2020-05-23 14:47:58 +0300
commit17a353f073a5e34bf033ad0013577063fcf6741c (patch)
treeae56d3f2bfff206945ece6adf78870775e9bb506 /docs
parent367068f6a9bd0b63b21b5a1832a0b2af4344f4c2 (diff)
downloadapscheduler-17a353f073a5e34bf033ad0013577063fcf6741c.tar.gz
Refactored the triggers
Triggers are now stateful, allowing for correct operation of the combining triggers. They are also JSON serializable now.
Diffstat (limited to 'docs')
-rw-r--r--docs/modules/triggers/cron.rst15
-rw-r--r--docs/modules/triggers/interval.rst16
2 files changed, 8 insertions, 23 deletions
diff --git a/docs/modules/triggers/cron.rst b/docs/modules/triggers/cron.rst
index a410bc2..4758321 100644
--- a/docs/modules/triggers/cron.rst
+++ b/docs/modules/triggers/cron.rst
@@ -19,8 +19,8 @@ This is the most powerful of the built-in triggers in APScheduler. You can speci
on each field, and when determining the next execution time, it finds the earliest possible time that satisfies the
conditions in every field. This behavior resembles the "Cron" utility found in most UNIX-like operating systems.
-You can also specify the starting date and ending dates for the cron-style schedule through the ``start_date`` and
-``end_date`` parameters, respectively. They can be given as a date/datetime object or text (in the
+You can also specify the starting date and ending dates for the cron-style schedule through the ``start_time`` and
+``end_time`` parameters, respectively. They can be given as a date/datetime object or text (in the
`ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_ format).
Unlike with crontab expressions, you can omit fields that you don't need. Fields greater than the least significant
@@ -96,10 +96,10 @@ Examples
sched.start()
-You can use ``start_date`` and ``end_date`` to limit the total time in which the schedule runs::
+You can use ``start_time`` and ``end_time`` to limit the total time in which the schedule runs::
# Runs from Monday to Friday at 5:30 (am) until 2014-05-30 00:00:00
- sched.add_job(job_function, 'cron', day_of_week='mon-fri', hour=5, minute=30, end_date='2014-05-30')
+ sched.add_job(job_function, 'cron', day_of_week='mon-fri', hour=5, minute=30, end_time='2014-05-30')
The :meth:`~apscheduler.schedulers.base.BaseScheduler.scheduled_job` decorator works nicely too::
@@ -111,10 +111,3 @@ The :meth:`~apscheduler.schedulers.base.BaseScheduler.scheduled_job` decorator w
To schedule a job using a standard crontab expression::
sched.add_job(job_function, CronTrigger.from_crontab('0 0 1-15 may-aug *'))
-
-The ``jitter`` option enables you to add a random component to the execution time. This might be useful if you have
-multiple servers and don't want them to run a job at the exact same moment or if you want to prevent jobs from running
-at sharp hours::
-
- # Run the `job_function` every sharp hour with an extra-delay picked randomly in a [-120,+120] seconds window.
- sched.add_job(job_function, 'cron', hour='*', jitter=120)
diff --git a/docs/modules/triggers/interval.rst b/docs/modules/triggers/interval.rst
index f7b8ae4..df7a593 100644
--- a/docs/modules/triggers/interval.rst
+++ b/docs/modules/triggers/interval.rst
@@ -17,11 +17,11 @@ Introduction
This method schedules jobs to be run periodically, on selected intervals.
-You can also specify the starting date and ending dates for the schedule through the ``start_date`` and ``end_date``
+You can also specify the starting date and ending dates for the schedule through the ``start_time`` and ``end_time``
parameters, respectively. They can be given as a date/datetime object or text (in the
`ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_ format).
-If the start date is in the past, the trigger will not fire many times retroactively but instead calculates the next
+If the start time is in the past, the trigger will not fire many times retroactively but instead calculates the next
run time from the current time, based on the past start time.
@@ -46,10 +46,10 @@ Examples
sched.start()
-You can use ``start_date`` and ``end_date`` to limit the total time in which the schedule runs::
+You can use ``start_time`` and ``end_time`` to limit the total time in which the schedule runs::
# The same as before, but starts on 2010-10-10 at 9:30 and stops on 2014-06-15 at 11:00
-   sched.add_job(job_function, 'interval', hours=2, start_date='2010-10-10 09:30:00', end_date='2014-06-15 11:00:00')
+   sched.add_job(job_function, 'interval', hours=2, start_time='2010-10-10 09:30:00', end_time='2014-06-15 11:00:00')
The :meth:`~apscheduler.schedulers.base.BaseScheduler.scheduled_job` decorator works nicely too::
@@ -59,11 +59,3 @@ The :meth:`~apscheduler.schedulers.base.BaseScheduler.scheduled_job` decorator w
@sched.scheduled_job('interval', id='my_job_id', hours=2)
def job_function():
print("Hello World")
-
-
-The ``jitter`` option enables you to add a random component to the execution time. This might be useful if you have
-multiple servers and don't want them to run a job at the exact same moment or if you want to prevent multiple jobs
-with similar options from always running concurrently::
-
- # Run the `job_function` every hour with an extra-delay picked randomly in a [-120,+120] seconds window.
- sched.add_job(job_function, 'interval', hours=1, jitter=120)