Product SiteDocumentation Site

8.2. Time/Date Based Expressions

După cum sugerează numele, date_expressions sunt folosite pentru a controla o resursă sau opţiune a clusterului pe baza timpului/dăţii curente. Acestea pot conţine opţional obiecte date_spec şi/sau duration în funcţie de context.

Tabel 8.3. Proprietăţile unei Expresii de Dată

Câmp Descriere
start
A date/time conforming to the ISO8601 specification.
end
A date/time conforming to the ISO8601 specification. Can be inferred by supplying a value for start and a duration.
operation
Compară data/ora curentă cu data de început şi/sau sfârşit, în funcţie de context. Valori permise:
* gt - True if the current date/time is after start
* lt - True if the current date/time is before end
* in-range - True if the current date/time is after start and before end
* date-spec - performs a cron-like comparison to the current date/time

Notă

As these comparisons (except for date_spec) include the time, the eq, neq, gte and lte operators have not been implemented since they would only be valid for a single second.

8.2.1. Date Specifications

Obiectele date_spec sunt folosite pentru a crea expresii similare cu cele create de cron în relaţie cu timpul. Fiecare câmp poate conţine un singur număr sau un singur şir. În loc să aibe valoarea implicită zero, orice câmp a cărui valoare nu este furnizată este ignorat.
De exemplu, monthdays="1" se potriveşte pentru prima zi din fiecare lună şi hours="09-17" se potriveşte orelor între 9am şi 5pm (inclusiv). Însă la acest moment nu se poate specifica weekdays="1,2" sau weekdays="1-2,5-6" din moment ce conţin şiruri multiple. În funcţie de cerere, acest aspect ar putea fi implementat într-un release viitor.

Tabel 8.4. Proprietăţile unei Specificaţii de Dată

Câmp Descriere
id
A unique name for the date
hours
Allowed values: 0-23
monthdays
Allowed values: 0-31 (depending on month and year)
weekdays
Allowed values: 1-7 (1=Monday, 7=Sunday)
yeardays
Allowed values: 1-366 (depending on the year)
months
Allowed values: 1-12
weeks
Allowed values: 1-53 (depending on weekyear)
years
Year according the Gregorian calendar
weekyears
May differ from Gregorian years; Eg. 2005-001 Ordinal is also 2005-01-01 Gregorian is also 2004-W53-6 Weekly
moon
Allowed values: 0-7 (0 is new, 4 is full moon). Seriously, you can use this. This was implemented to demonstrate the ease with which new comparisons could be added.