Making parameters flexible

I have a suite that runs an ensemble and uses

[cylc]
  [[parameters]]
     member = 1..10

Now I need to specify the beginning member and the size of the ensemble.
I tried this

 [cylc]
    [[environment]] 
       ensemble_start = 10
       ensemble_end = 20
    [[parameter]]
       member = $ensemble_start .. $ensemble_end

but I think I can’t use variables in the member parameter. Any suggestions?

Hi @Jim

You can’t use shell environment variables like that (they are made available to shell processes executed by the scheduler). But you can use Jinja2 code anywhere in the workflow configuration (think of Jinja2 as a preprocessor that programmatically generates the final workflow config that the scheduler sees).

#!Jinja2

{% set ensemble_start = 10 %}
{% set ensemble_end = 20 %}
# ...
    [[parameters]]
        member = {{ensemble_start}}..{{ensemble_end}}
# ...

Hilary

I already use jinja2, but didn’t think of it. Works great, thanks!