Hi,
I’m new to Cylc and trying to work with variable substitution within flow.cylc. This is snippet I have, say:
[[HOFXRun]]
script = "pywalker RunJediExecutable $config -d $datetime"
platform = $(platform)
execution time limit = $(execution_time_limit)
[[[directives]]]
--account = $(account)
--qos = $(qos)
--constraint = $(constraint)
--job-name = HOFXRun
--nodes=$(nodes)
--ntasks-per-node=$(ntasks_per_node)
When the user creates the experiment these would be substituted by some variables of their choosing. I have a dictionary ready to go (that changes with task) containing the values of the variables so it seems a natural thing to do is:
from cylc.flow.parsec import fileparse
target = fileparse.parse("/path/flow.cylc")
Then substitute $()
in target using keys from the other dictionary and then rewrite the flow.cylc. But I don’t see anything for writing the dictionary to back to the cylc format INI. Perhaps I’m just missing it or perhaps I’m thinking about this substitution problem the wrong way and missing a feature elsewhere in Cylc. Perhaps I should be utilizing the platform differently? I could go line by line in the flow.cylc reading as a string and do the substitution but I need to know the name of the task in order to perform the correct substitution so using the dictionary approach seems more sensible and saves me writing my own parser. Anyway would appreciate any advice you have for a newbie!