Unique Scheduling Specification

I am using Cylc version 7.9.3. I’ve come across a particular situation where I need particular tasks to run only once at the beginning of the suite, but only if the hour is a 00z or 12z. So if the initial cycle point is 20210806T06, then this task should only run once and it should only run on 20210806T12. So far, I have this:

    graph = """
        stage_verify => grid_stat_run

Testing this, though, shows that stage_verify (which is the task I want to only run once), in fact runs every cycle point that ends in a 00Z or 12Z.

How do I get this to only run once during the course of the entire cycling but during the first instance of a 00Z or 12Z, whichever comes first relative to the initial cycle point?

Firstly, [[[R1/T00,T12]]] is equivalent to (separately) [[[R1/T00]]] and [[[T12]]](not R1/T12). So you should see, e.g. via cylc graph or at run time, that the tasks will run at the first T00 and T12 points, and every T12 after that.
So it should be [[[R1/T00, R1/T12]]] if you want to combine them.

However, for what you really want, try this:

initial cycle point = next(T00; T12)  # note semicolon separator
   graph = "stage_verify => grid_stat_run"

In the old Cylc 7 documentation, see: 15.1. Suite.rc Reference — The Cylc Suite Engine 7.9.3 documentation

For Cylc 8: Scheduling Configuration — Cylc 8.2.3 documentation

Thanks for the quick response. What if I wanted to accomplish this relative to a specified initial cycle point instead of current local time?

If you are setting the ICP, why would you not set it to be anything other than --------T12–Z or T00–Z?

If you are writing for other users you can set [scheduler]initial cycle point constraints:

    initial cycle point constraints = T00, T12


It’s ugly, but it does the job:

    allow implicit tasks = True

    initial cycle point = 2000-01-01T12Z
        R1/T00 ! ( R1/^+PT6H, R1/^+PT12H, R1/^+PT18H, R1/^+PT24H) = """
        R1/T12 ! ( R1/^+PT6H, R1/^+PT12H, R1/^+PT18H, R1/^+PT24H) = """
  • R1/T00 - run once at the first instance of T00
  • R1/^+PT6H - run once, six hours after the initial cycle point
  • R1/T00 ! R1/^+PT6H - run once at the first instance of T00 UNLESS it is six hours after the initial cycle point.
  • R1/T00 ! ( R1/^+PT6H, R1/^+PT12H, R1/^+PT18H, R1/^+PT24H) - run once at the first instance of T00 UNLESS it is a multiple of six hours after the initial cycle point.

Chaining up long lists of exclusions (!) can increase the computational load of the scheduler, but in this case the recurrence is only run once (R1) so the impact won’t persist for the live of the workflow.

However, it is worth noting that there is also a Jinja2 solution using the strftime filter:


{# untested! #}

{% set ICP="2000-01-01T00" %}

    initial cycle point = {{ ICP }}
{% if ICP | strftime('%H') == '00' %}
        R1/T00 = t00
{% else if ICP | strftime('%H') == '12' %}
        R1/T12 = t12
{% endif %}

Ar rare case where the Jinja2 solution might actually be a little more readable!

This is a specific scenario where verification must only be run on the 0z and 12z times, as we only have verifying data for these hours. However, the user might want to start forecasts on 6z or 18z. If this occurs, verification will not occur on 6z/18z but will occurs one cycle later (12z/0z, respectively)

Thank you! The “exclusions” hyperlink actually led me to the very answer that I needed. The syntax that worked for me was


This runs the intended tasks in the first 00z or 12z (but not both), after the ICP. I just tested this and it works as I expect.

I appreciate the help

1 Like