summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGilbert Gilb's <gilbsgilbs@users.noreply.github.com>2017-12-10 19:43:22 +0100
committerAlex Grönholm <alex.gronholm@nextday.fi>2017-12-10 20:43:22 +0200
commit60c757c9d95c50d66ec2e1abc03b459b45702e58 (patch)
tree32f6f50e97e1c1e650c1e099a5f77d9526b327f2 /docs
parentc6c5031276c3b864e127c637d2bdd48138a0b426 (diff)
downloadapscheduler-60c757c9d95c50d66ec2e1abc03b459b45702e58.tar.gz
Implement random jitter option for CronTrigger and IntervalTrigger (#258)
Diffstat (limited to 'docs')
-rw-r--r--docs/modules/triggers/cron.rst8
-rw-r--r--docs/modules/triggers/interval.rst8
2 files changed, 16 insertions, 0 deletions
diff --git a/docs/modules/triggers/cron.rst b/docs/modules/triggers/cron.rst
index 85f8f83..791156d 100644
--- a/docs/modules/triggers/cron.rst
+++ b/docs/modules/triggers/cron.rst
@@ -104,3 +104,11 @@ The :meth:`~apscheduler.schedulers.base.BaseScheduler.scheduled_job` decorator w
@sched.scheduled_job('cron', id='my_job_id', day='last sun')
def some_decorated_task():
print("I am printed at 00:00:00 on the last Sunday of every month!")
+
+
+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 5fec5b0..f7b8ae4 100644
--- a/docs/modules/triggers/interval.rst
+++ b/docs/modules/triggers/interval.rst
@@ -59,3 +59,11 @@ 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)