So I am currently working on a clean up task that is meant to clean up some temporary directories for cycle points n cycles back but for that I need to know what the desired cycle point
For example, say I’m at cycle point 10000101T000000 and I want to know what the cycle point name is. I could obviously use the recurrence information, along with the current cycle point to figure this out, but that would involve some date logic that I’d hope to avoid. It seems like there should be a simpler way to handle it.
Is there a way within cylc to figure this out? If not, any ideas on the best way to do this?
Isodatetime provides the cylc-flow date-time functionality, it’s a Cylc project and a dependency of Cylc so the command should always be available in the Cylc environment. (note if you are using a wrapper script for Cylc isodatetime will need the same treatment).
the start time of our simulation - lets call this start_date
the end time of our simulation (end_date), and
the simulation chunk size (chunk_size)
and we assign start_date as our initial cycle point
does cylc have any capabilities to easily determine all the cycle points? Specifically the final cycle point, which to be consistent in our date handling and to allow us properly set the dependencies for our final task (we need something similar to this), we need it to be the beginning date of the final task.
Or is the main option to use cylc cycle-point (or some other tool) to do the arithmetic ourselves? It’s definitely feasible for us to do so - we just want to know that we wouldn’t be duplicating technology that is built in to cylc
Well, I may be missing your point, but Cylc does compute “all the cycle points” automatically, as the workflow runs.
Is this sort of thing not what you want?:
[scheduler]
allow implicit tasks = True
[scheduling]
initial cycle point = 2050
final cycle point = 2055
[[graph]]
R1 = "prep => sim" # first point
P1Y = "sim[-P1Y] => sim => post" # all P1Y points
R1/$ = "post => beer" # final point
[runtime]
[[root]]
script = "sleep 1"
Note the sequence of cycle points here is determined by the initial point and the interval, not the final point (which is essentially a cut-off)… BUT recurrence expressions that explicitly reference the final point (e.g. R1/$) do work with the specified final point. So it is up to you to make sure that the final point lies on the main sequence (if that’s what you want).
If a particular task needs to know all the points in advance for some reason, you could compute them in a bash loop that repeatedly calls cylc cyclepoint.
Easier, the isodatetime command mentioned above can print points in a sequence, e.g.: