ISO8601 is a mystery

I really struggle to figure out the date syntax, I would like to run once per quarter on dates 2/1,5/1,8/1,11/1 for years 1958 to present. Here is what I have to run once per year in Feb, can anyone help me to get to where I want to go?

  # Change the run start and end dates here
    initial cycle point = "1958-02-01"
    final cycle point = "2021-02-01"

  [[dependencies]]
  # run needs to finish, not necessarily successfully for next step to start
    [[[R/P1Y]]]
      graph = """
        st_archive<member>[-P1Y] => build_model => run_family:finish-all 
	postprocess_family:finish-all => dispose
        run<member> => st_archive<member> => postprocess<member> 
	     """

Hi Jim,

How about this:

[cylc]
   cycle point format = "%Y-%m-%d"
[scheduling]  
   initial cycle point = "1958-02-01"
   final cycle point = "2021-02-01"
    # must start Feb 01, any year:
   initial cycle point constraints = "0201T00" 
   [[dependencies]]
       [[[R/P3M]]]  # 3-month cycle 
          graph = foo  # etc.

This generates:

foo.1958-02-01
foo.1958-05-01
foo.1958-08-01
foo.1958-11-01
foo.1959-02-01
foo.1959-05-01
foo.1959-08-01
foo.1959-11-01
foo.1960-02-01
foo.1960-05-01
foo.1960-08-01
foo.1960-11-01
etc.

And for the inter-cycle trigger, use (e.g.) foo[-P1Y] or foo[-P3M] depending on your requirements…

1 Like

A more complex approach which can be useful if you need to decouple this recurrence from the initial cycle point is to use min():

[scheduling]
    initial cycle point = now
    [[dependencies]]
        # every three months starting at the first 0201, 0501, 0801, 1101
        # that occurs AFTER the initial cycle point
        [[[min(0201T00, 0501T00, 0801T00, 1101T00)/P3M]]]
            graph = foo

There’s some documentation on min() in the “graph section headings” section - 9. Suite Configuration — The Cylc Suite Engine 7.9.3 documentation

Note: you need the T00 bit in order to differentiate MMDD from CCYY.

2 Likes

Thank you very much, this is really helpful. One more question - I need to parse out part of the date to use as a string. I found this in an example somewhere but it doesn’t seem to work - what am I missing?

[cylc]

   cycle point format = "%Y-%m-%d"
   [[environment]]
   CYLC_TASK_CYCLE_DATE = $(cylc cyclepoint --template=%Y-%m)
[scheduling]

   initial cycle point = "1958-02-01"

   final cycle point = "2021-02-01"

    # must start Feb 01, any year:

   initial cycle point constraints = "0201T00"

   [[dependencies]]

       [[[R/P3M]]]  # 3-month cycle

          graph = foo  # etc.
[runtime]
  [[foo]]
    script = """
echo $CYLC_TASK_CYCLE_DATE
"""

The result I get is:

Suite    : cylctest
Task Job : 1958-02-01/foo/01 (try 1)
User@Host: jedwards@cheyenne4

$(cylc cyclepoint --template=%Y-%m)
2021-02-04T09:34:17-07:00 INFO - started
2021-02-04T09:34:18-07:00 INFO - succeeded

I figured this one out - it should be:

[cylc]

   cycle point format = "%Y-%m-%d"
[scheduling]

   initial cycle point = "1958-02-01"

   final cycle point = "2021-02-01"

    # must start Feb 01, any year:

   initial cycle point constraints = "0201T00"

   [[dependencies]]

       [[[R/P3M]]]  # 3-month cycle

          graph = foo  # etc.
[runtime]
  [[foo]]
    script = """
echo $CYLC_TASK_CYCLE_DATE
"""
    [[[environment]]]
       CYLC_TASK_CYCLE_DATE = $(cylc cyclepoint --template=%Y-%m)

Hi Jim,

To explain that, your first example is setting a variable in the scheduler environment, when the scheduler starts up. “Cycle point” is not a concept that makes any sense in that context because Cylc has no global cycle loop. Only individual task instances have cycle points - and you’re correctly setting the variable in the task job environment in your second example.

Hilary