mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-30 10:23:41 -04:00
* Add timezone support to Cron objects * Add timezone support to CronnableSchedule * XContent change to support parsing and display of TimeZone fields on schedules * Case insensitive timezone parsing * Doc changes * YAML REST tests * Equals, toString and HashCode now include timezone * Additional random testing for DST transitions * Migrate Cron class to use wrapped LocalDateTime The algorithm depends on some quirks of calendar but LocalDateTime correctly ignores DST during calculations so this uses a LocalDateTime with a wrapper to emulate some of Calendar's behaviours that the Cron algorithm depends on * Additional documentation to explain discontinuity event behaviour * Remove redundant conversions from ZoneId to TimeZone following move to LocalDateTime * Add documentation warning that manual clock changes will cause unpredictable watch execution * Update docs/reference/watcher/trigger/schedule.asciidoc Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com> --------- Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
113 lines
3.5 KiB
Text
113 lines
3.5 KiB
Text
[role="xpack"]
|
|
[[schedule-yearly]]
|
|
==== {watcher} yearly schedule
|
|
++++
|
|
<titleabbrev>Yearly schedule</titleabbrev>
|
|
++++
|
|
|
|
A <<trigger-schedule,`schedule`>> that triggers at a specific day and time
|
|
every year. To use the `yearly` schedule, you specify the month, day, and time
|
|
(or months, days, and times) when you want the scheduler to start the watch
|
|
execution with the `in`, `on`, and `at` attributes.
|
|
|
|
You can specify the month by name, abbreviation, or number:
|
|
|
|
* `january`, `february`, `march`, `april`, `may`, `june`, `july`,
|
|
`august`, `september`, `october`, `november` and `december`
|
|
|
|
* `jan`, `feb`, `mar`, `apr`, `may`, `jun`, `jul`, `aug`,
|
|
`sep`, `oct`, `nov` and `dec`
|
|
|
|
* `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11` and `12`
|
|
|
|
You specify the day of month as a numeric value between `1` and `31` (inclusive).
|
|
The Times are specified in the form `HH:mm` on a 24-hour clock. You can also use
|
|
the reserved values `midnight` and `noon` for `00:00` and `12:00`.
|
|
|
|
===== Configuring a yearly schedule
|
|
|
|
To configure a once a year schedule, you specify the month with the `in` attribute,
|
|
the day with the `on` attribute, and the time with the `at` attribute. For
|
|
example, the following `yearly` schedule triggers once a year at noon on January
|
|
10th:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"trigger" : {
|
|
"schedule" : {
|
|
"yearly" : { "in" : "january", "on" : 10, "at" : "noon" }
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// NOTCONSOLE
|
|
|
|
NOTE: You can also specify the month, day, and time with the `month`, `day`, and
|
|
`time` attributes, they are interchangeable with `in`, `on`, and `at`.
|
|
|
|
===== Configuring a multiple times yearly schedule
|
|
|
|
To configure a `yearly` schedule that triggers multiple times a year, you can
|
|
specify an array of month, day, and time values. For example, the following
|
|
`yearly` schedule triggers twice a year: at noon on January 10th, and at 5:00 PM
|
|
on July 20th.
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"trigger" : {
|
|
"schedule" : {
|
|
"yearly" : [
|
|
{ "in" : "january", "on" : 10, "at" : "noon" },
|
|
{ "in" : "july", "on" : 20, "at" : "17:00" }
|
|
]
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// NOTCONSOLE
|
|
|
|
Alternatively, you can specify the months, days, and times in an object that has
|
|
`in`, `on`, and `minute` attributes that contain an array of values. For example,
|
|
the following `yearly` schedule triggers at 12:00 AM and 12:00 PM on January 10th,
|
|
January 20th, December 10th, and December 20th.
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"trigger" : {
|
|
"schedule" : {
|
|
"yearly" : {
|
|
"in" : [ "jan", "dec" ],
|
|
"on" : [ 10, 20 ],
|
|
"at" : [ "midnight", "noon" ]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// NOTCONSOLE
|
|
|
|
==== Configuring a yearly schedule with a different time zone
|
|
By default, the `yearly` schedule is evaluated in the UTC time zone. To use a
|
|
different time zone, you can specify the `timezone` parameter in the schedule.
|
|
For example, the following `yearly` schedule triggers at 3:30 PM and 8:30 PM
|
|
on June 4th in the `Antarctica/Troll` time zone:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"trigger" : {
|
|
"schedule" : {
|
|
"timezone" : "Antarctica/Troll",
|
|
"yearly" : {
|
|
"in" : "june",
|
|
"on" : 4,
|
|
"at" : [ 15:30, 20:30 ]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// NOTCONSOLE
|