Skip to content

Commit 76922ea

Browse files
authored
Merge pull request #559 from douglasjacobsen/escaped_templates
Add docs about var escaping in templates
2 parents 2b986ef + 121fcbf commit 76922ea

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

lib/ramble/docs/workspace.rst

+28-3
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,37 @@ This various parts of this directory structure are defined as:
123123

124124
In the ``configs`` directory, the ``ramble.yaml`` file is the primary workspace
125125
configuration file. The definition for this file is documented in the
126-
:ref:``workspace config documentation<workspace-config>``
126+
:ref:`workspace config documentation<workspace-config>`
127127

128+
^^^^^^^^^^^^^^^^^^^^^^^^
129+
Workspace Template Files
130+
^^^^^^^^^^^^^^^^^^^^^^^^
128131

129132
Every file with the ``.tpl`` extension is considered a template file in the
130-
workspace. These are rendered into each experiment (with the extension
131-
omitted). This allows control over the script format to execute an experiment.
133+
workspace. Every one of these are rendered into each experiment (with the
134+
extension omitted).
135+
136+
Workflows can be constructed by chaining multiple of these template files
137+
together. Ramble will define a variable within each experiment that will be the
138+
name of the file (without the extenison) and the value will be the absolute
139+
path to the rendered template.
140+
141+
As an example, if the file ``configs/execute_experiment.tpl`` exists, each
142+
experiment will have a variable ``execute_experiment`` who's value is set to
143+
something like:
144+
``{workspace_root}/experiments/{application_name}/{workload_name}/{experiment_name}/execute_experiment``
145+
146+
Ramble supports arbitrary format template files. Variables can be referenced
147+
within these files using the standard ``{`` and ``}`` syntax. Nested variable
148+
expansion is possible by using repeated curly braces (i.e. ``{{foo}}`` will
149+
evaluate ``{foo}``, and if this expands to ``bar`` then the result will be the
150+
expansion of ``{bar}``).
151+
152+
**NOTE:** Some file formats require escaping curly braces to ensure their
153+
format is correct. This happens frequently with JSON and YAML formatted
154+
template files. For more information on escaping expansion characters, see
155+
:ref:`ramble-escaped-variables` in the :ref:`workspace config
156+
documentation<workspace-config>`
132157

133158

134159
----------------------

lib/ramble/docs/workspace_config.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ Escaped Variables
184184
When referring to variables in Ramble, sometimes it is useful to be able to
185185
escape curly braces to prevent the expander from fully expanding the variable
186186
reference. Curly braces that are prefixed with a back slash (i.e. ``\{`` or
187-
``\}``) will be ignored by the expander.
187+
``\}``) will be replaced with an unexpanded curly brace by Ramble's expander.
188188

189189
Each time the variable is expanded, the escaped curly braces will be replaced
190190
with unescaped curly braces (i.e. ``\{`` will expand to ``{``). Additional back

0 commit comments

Comments
 (0)