Rose: Any way to get list of opt conf keys used?

Hi,

If you use rose task-run to launch an app and pass it opt conf keys from that command, e.g. rose task-run -O foo -O bar, is it possible to find out what opt conf keys were used? I couldn’t see any reference to them in any environment variables. I know I can look in the job.out file, but I was hoping there was a way to just know from shell. Yes, I know the environment variable ROSE_APP_OPT_CONF_KEYS could be used, but its a bit tedious using that if you’re needing to use a default and add things to it as Cylc does not support mutations of previously defined items natively.

I’ve had a think and a look a the docs, but I couldn’t see an easy way of doing this.

The best I can come up with is:

default=ROSE_TASK_CMD=$(grep "rose task-run" "${ROSE_TASK_LOG_ROOT}")
       =echo "ROSE_TASK_CMD=${ROSE_TASK_CMD}"
       =ROSE_TASK_OPTS=$(python -c 'import re; getopts = re.compile("(?:-O|--opt-conf-key)\s+(\S+)"); print(" ".join(getopts.findall("rose task-run -O foo -O bar")))')
       =echo "ROSE_TASK_OPTS=${ROSE_TASK_OPTS}"

YMMV: You might be able to write the regex in Bash or Perl to avoid the expensive Python call.
You can probably condense this into a one liner at the expense of making it even less readable.

@oliver.sanders - is this a variable it would be reasonable to have rose export?

Hi,

From a bit of playing, it seems the optional configs that are used get logged in verbose mode. If you add -v onto the rose task-run command, you should see something like this:

[INFO] Configuration: app/myapp
[INFO]     file: rose-app.conf
[INFO]     optional key: foo

The processed configuration that Rose used (which includes any optional config overrides) is also output to the rose-app-run.conf which should be written to the task’s working directory.

It would be reasonable to add opts into the rose-app-run.conf (but commented out) similar to what we do with the rose-suite-cylc-install.conf file to make it easier for people to access the linearised optional config list post-run.