Task parameter templates

Hello,

I am setting up a suite of ensemble runs where I am parameterizing tasks via:
[task parameters]
year = 2013
month = 04
day = 01
hour = 00

I’m finding that when I use environment variables like $CYLC_TASK_PARAM_month in my bash script that the leading zero has been stripped. I used to know how to do this in cylc7 but can’t seem to get it working in 8b1. If someone could point me in the right direction I’d greatly appreciate it. :slight_smile:

Hi @bencash,

You can use printf-style string templates for task parameters:

[task parameters]
year = 2013
month = 04
day = 01
hour = 00
  [[templates]]
     year = _%(year)04d
     month = _%(month)02d
     day = _%(day)02d
     hour = _%(hour)02d
[scheduling]
  [[graph]]
    R1 = foo<year><month><day><hour>
[runtime]
  [[foo<year><month><day><hour>]]

Result:

$ cylc list flow.cylc
foo_2013_04_01_00

The same applies to the [runtime] section:

[runtime]
    [[task<month>]]
        script = echo $MONTH
        [[[environment]]]
            MONTH = %(month)02d