Tip: Cycle Point Format

Cylc uses the ISO8601 time point syntax for cycle points.

For example, this workflow:

[scheduling]
    initial cycle point = 2020
    [[graph]]
        P1Y = @wall_clock => happy-new-year

[runtime]
    [[happy-new-year]]
        script = echo "Happy ${CYLC_TASK_CYCLE_POINT}!"

Will produce cycle points like this:

  • 20200101T0000Z
  • 20210101T0000Z
  • 20220101T0000Z

These cycle points are used to form task IDs and are passed into tasks using the $CYLC_TASK_CYCLE_POINT environment variable:

$ cylc cat-log <id>//20200101T0000Z/happy-new-year
Happy 20200101T0000Z!

But this workflow only cycles once a year so having cycle point precision down to the minute isn’t very helpful. This is where the cycle point format comes in, it allows us to change how the cycle point is presented. E.G. if we want the cycle point to just contain the year we could add these lines into the workflow configuration:

[scheduler]
    cycle point format = CCYY  # Note: C=century, Y=year-of-century

This will now produce cycle points like:

  • 2020
  • 2021
  • 2022

This will change task IDs as well as the value of the $CYLC_TASK_CYCLE_POINT environment variable:

$ cylc cat-log <id>//2020/happy-new-year/NN/
Happy 2020!

That’s better!

You can also use the isodatetime command (which is provided with Cylc) to extract information from ISO8601 time points e.g:

$ isodatetime 20230703T1351Z --f 'CCYY'
2023
2 Likes