Precedence of template variables set with -s/-S and -O

Hi,

I was just hoping to clarify my understanding of the precendence of template variables set with -s and -O.

Initially I had expected that the precedence would depend on the ordering of the -s and -O options in the cylc command, but that does not appear to be the case.

E.g., if in a file opt/rose-suite-common.conf I have VAR_A="set in opt conf", and I run

cylc vip -O common -s 'VAR_A="set with -s"' .

or

cylc vip -s 'VAR_A="set with -s"' -O common .

In both cases I see the message;
WARNING - Overriding VAR_A: set in opt conf -> set with -s, and the template variable is set to the -s setting.

So, am I understanding correctly that -s/-S will always take precendence over optional config? I think that I’ve probably answered my own question with the example above, but also wanted to confirm that this is the intended behaviour.

Note, in practice I am actually using -S due to reload: allow template variables to change on reload · Issue #6045 · cylc/cylc-flow · GitHub), and when using -S there is no override warning message).

The general principle is that command line options should override optional configs, so this is the intended behaviour.

  • -O will override default values from the rose-suite.conf
  • -S will override settings from -O and the rose-suite.conf.
  • -s (lowercase) will override all the above.

It’s worth noting that -s and -S, although similar are not the same argument (-s is a basic Cylc argument, -S is delivered by the Cylc Rose plugin). This is important because it’s easier to find out what you used with the Rose version (-S), and because -S will work with cylc install.

Values set with -S will be recorded by the install step in ~/cylc-run/<workflow>/opt/rose-suite-cylc-install.conf. -s is only available when you use cylc play, and it may be difficult to rediscover values set using it.

1 Like

Thanks @wxtim, that explanation is very clear

1 Like