mesos에서 chronos 프레임워크를 사용할 때 ISO 8601 - duration 정책을 사용한다. 




https://mesos.github.io/chronos/docs/api.html



schedule: The scheduling for the job, in ISO 8601 format. Consists of 3 parts separated by /:
  • The number of times to repeat the job: Rn to repeat n times, or R to repeat forever
  • The start time of the job. An empty start time means start immediately. Our format is ISO 8601YYYY-MM-DDThh:mm:ss.sTZD (e.g., 1997-07-16T19:20:30.45+01:00) where:
    • YYYY = four-digit year
    • MM = two-digit month (01 = January, etc.)
    • DD = two-digit day of month (01 through 31)
    • hh = two-digit hour in 24-hour time (00 through 23)
    • mm = two-digit minute (00 through 59)
    • ss = two-digit second (00 through 59)
    • s = one or more digits representing a decimal fraction of a second
    • TZD = time zone designator (Z for UTC or +hh:mm or -hh:mm for UTC offset)
  • The run interval, defined following the “Duration” component of the ISO 8601 standard. P is required. T is for distinguishing M(inute) and M(onth)––it is required when specifying Hour/Minute/Second. For example:
    • P10M = 10 months
    • PT10M = 10 minutes
    • P1Y12M12D = 1 year, 12 months, and 12 days
    • P12DT12M = 12 days and 12 minutes
    • P1Y2M3DT4H5M6S = 1 year, 2 months, 3 days, 4 hours, and 5 minutes




Here is an example job hash: json { "schedule": "R10/2012-10-01T05:52:00Z/PT2S", "name": "SAMPLE_JOB1", "epsilon": "PT15M", "command": "echo 'FOO' >> /tmp/JOB1_OUT", "owner": "bob@airbnb.com", "async": false }



Durations[edit]

PnYnMnDTnHnMnS
PnW
P<date>T<time>

Durations define the amount of intervening time in a time interval and are represented by the format P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W as shown to the right. In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required, but the maximum number of digits for each element should be agreed to by the communicating parties. The capital letters PYMWDTHM, and S are designators for each of the date and time elements and are not replaced.

  • P is the duration designator (for period) placed at the start of the duration representation.
  • Y is the year designator that follows the value for the number of years.
  • M is the month designator that follows the value for the number of months.
  • W is the week designator that follows the value for the number of weeks.
  • D is the day designator that follows the value for the number of days.
  • T is the time designator that precedes the time components of the representation.
    • H is the hour designator that follows the value for the number of hours.
    • M is the minute designator that follows the value for the number of minutes.
    • S is the second designator that follows the value for the number of seconds.

For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds".

Date and time elements including their designator may be omitted if their value is zero, and lower order elements may also be omitted for reduced precision. For example, "P23DT23H" and "P4Y" are both acceptable duration representations. However, at least one element must be present, thus "P" is not a valid representation for a duration of 0 seconds. "PT0S" or "P0D", however, are both valid and represent the same duration.

To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value). The smallest value used may also have a decimal fraction, as in "P0.5Y" to indicate half a year. This decimal fraction may be specified with either a comma or a full stop, as in "P0,5Y" or "P0.5Y". The standard does not prohibit date and time values in a duration representation from exceeding their "carry over points" except as noted below. Thus, "PT36H" could be used as well as "P1DT12H" for representing the same duration. But keep in mind that "PT36H" is not the same as "P1DT12H" when switching from or to Daylight saving time.

Alternatively, a format for duration based on combined date and time representations may be used by agreement between the communicating parties either in the basic format PYYYYMMDDThhmmss or in the extended format P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]. For example, the first duration shown above would be "P0003-06-04T12:30:05". However, individual date and time values cannot exceed their moduli (e.g. a value of 13 for the month or 25 for the hour would not be permissible).[30]

Although the standard describes durations as part of time intervals, which are discussed in the next section, the duration format is widely used independent of time intervals, as with the Java 8 Duration class[31][32].

Posted by '김용환'
,