Adding an item to user configuration¶
Note
Write a new item in rose-suite.conf¶
ThermoRawFileParser can output the metadata in text or json format. Right now, the workflow only outputs metadata in json. We can give the user the option to choose between the two formats.
At the end of the [template variables] section, add the following line:
rose-suite.conf¶# ...
cfg__raw_meta_format = txt
Use the template variable in the workflow definition¶
In the [validate_cfg] task, change the metadata environment variable to:
flow.cylc¶[runtime]
[[convert_raw]]
[[[environment]]]
- metadata = json
+ metadata = {{ cfg__raw_meta_format }}
During run installation, the value will now be replaced by the one set in rose-suite.conf.
If you want to change the value at runtime, you can follow the instructions in Configuring the workflow.
Validate the new configuration item¶
Rose (the configuration manager) allows us to validate the user configuration. It is done at runtime
at cyclepoint 0 with the [validate_cfg] task. Let’s add a new validation rule for our item.
Locate the meta/rose-meta.conf file in the workflow source directory, and add the following:
[template variables=cfg__raw_meta_format]
compulsory=true
type=character
values='json', 'txt'
The [validate_cfg] will now check that the value of cfg__raw_meta_format is either ‘json’ or ‘txt’, and that the item is indeed present.