Hi. I apologize profusely if the answer to this is spelled out in the docs – cylc.github.io is timing out for me right now.
My suite.rc uses platform-specific include files to handle things like batch queueing systems and parameters that vary from platform to platform. The way I’ve been handling it is to have a Jinja2 variable set at the top of the suite.rc, e.g.
{% set J_PLATFORM = "foo" %}
and then, near the bottom of the suite.rc, some lines that act based on the variable value:
# Platform dependence
{% if J_PLATFORM == "foo" %}
%include inc/platform_foo.cylcrc
{% elif J_PLATFORM == "bar" %}
%include inc/platform_bar.cylcrc
{% elif J_PLATFORM == "baz" %}
%include inc/platform_baz.cylcrc
{% else %}
{{ raise('User-specified configuration variable J_PLATFORM has invalid value.') }}
{% endif %}
While this form has worked fine for me, it also meant that every time someone installed the system on a new platform, after creating an include file (let’s say, inc/platform_mysys.cylcrc), it wasn’t enough that to just edit the top of suite.rc to set J_PLATFORM to “mysys”. They also had to add
an “elif” clause near the bottom to cover the new case as well.
So I wanted to replace the entire if/elif/endif block with something like this:
# Platform dependence
%include inc/platform_{{J_PLATFORM}}.cylcrc
Then, the only suite.rc change that would be required of the user installing our suite onto a new system would be to change what the J_PLATFORM variable was set to. However, this doesn’t validate: I get a FileParseError message telling me "Include-file not found: inc/platform_{{J_PLATFORM}}.cylcrc, as if the Jinja2 engine is not substituting in the value for {{J_PLATFORM}} prior to cylc examining the suite.rc contents. I don’t understand this, because I do it in other contexts in the same suite.rc, e.g.
{% set J_CP_CADENCE = "PT15M" %}
(stuff snipped)
[scheduling]
[[dependencies]]
(stuff snipped)
[[[ ^+{{J_CP_CADENCE}}/{{J_CP_CADENCE}} ]]]
and that works fine.
What am I missing?
Thanks!