Skip to content

Commit

Permalink
Archive templates rendered via register_template
Browse files Browse the repository at this point in the history
  • Loading branch information
linsword13 committed Jan 24, 2025
1 parent 8a4be53 commit 3420c27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ramble/ramble/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,12 @@ def _archive_experiments(self, workspace, app_inst=None):
if os.path.exists(src):
shutil.copy(src, archive_experiment_dir)

# Copy all rendered templates generated by `register_template`
for _, tpl_config in self._object_templates(workspace):
src_path = tpl_config["dest_path"]
if os.path.exists(src_path):
shutil.copy(src_path, archive_experiment_dir)

# Copy all figure of merit files
criteria_list = workspace.success_list
analysis_files, _, _ = self._analysis_dicts(criteria_list)
Expand Down
9 changes: 9 additions & 0 deletions lib/ramble/ramble/test/end_to_end/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ def test_template():
assert os.path.isfile(script3_path)
assert os.path.isfile(script4_path)

# Test template archival
workspace("archive", global_args=["-w", workspace_name])
exp_archive_path = os.path.join(
ws.latest_archive_path, "experiments", "template", "test_template", "test"
)
files = os.listdir(exp_archive_path)
assert "bar.sh" in files
assert "script.sh" in files


def test_template_inherited():
test_config = """
Expand Down

0 comments on commit 3420c27

Please sign in to comment.