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

**URL:** <https://cylc.discourse.group/t/precedence-of-template-variables-set-with-s-s-and-o/1121>\
**Category:** Rose Support\
**Created:** [February 13, 2025, 6:21am UTC](https://cylc.discourse.group/t/precedence-of-template-variables-set-with-s-s-and-o/1121 "2025-02-13T06:21:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesgrimmett](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jamesgrimmett/32/399_2.png) [@jamesgrimmett](https://cylc.discourse.group/u/jamesgrimmett)\
**Post date:** [February 13, 2025, 6:21am UTC](https://cylc.discourse.group/t/precedence-of-template-variables-set-with-s-s-and-o/1121/1 "2025-02-13T06:21:20Z")

</div>

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](https://github.com/cylc/cylc-flow/issues/6045)), and when using `-S` there is no override warning message).

---

<div class="post-metadata">

**Author:** ![wxtim](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/wxtim/32/151_2.png) [@wxtim](https://cylc.discourse.group/u/wxtim)\
**Post date:** [February 13, 2025, 9:05am UTC](https://cylc.discourse.group/t/precedence-of-template-variables-set-with-s-s-and-o/1121/2 "2025-02-13T09:05:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jamesgrimmett](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/jamesgrimmett/32/399_2.png) [@jamesgrimmett](https://cylc.discourse.group/u/jamesgrimmett)\
**Post date:** [February 13, 2025, 10:08pm UTC](https://cylc.discourse.group/t/precedence-of-template-variables-set-with-s-s-and-o/1121/3 "2025-02-13T22:08:03Z")

</div>

Thanks @wxtim, that explanation is very clear
