Skip to content

Commit

Permalink
Fix relative paths in FOM and Success criteria definitions
Browse files Browse the repository at this point in the history
This commit ensures that all log file paths in FOM and Success Criteria
are absolute paths instead of allowing relative paths.
  • Loading branch information
douglasjacobsen committed Jan 8, 2025
1 parent 2b97f7e commit 6821cd3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/ramble/ramble/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,11 @@ def _analysis_dicts(self, criteria_list):
# Extract file paths for all criteria
for criteria in criteria_list.all_criteria():
log_path = self.expander.expand_var(criteria.file)

# Ensure log path is absolute. If not, prepend the experiment run directory
if not os.path.isabs(log_path) and self.expander.experiment_run_dir not in log_path:
log_path = os.path.join(self.expander.experiment_run_dir, log_path)

if log_path not in files and os.path.exists(log_path):
files[log_path] = self._new_file_dict()

Expand Down Expand Up @@ -2094,6 +2099,10 @@ def _analysis_dicts(self, criteria_list):
for fom, conf in fom_definitions.items():
log_path = self.expander.expand_var(conf["log_file"])

# Ensure log path is absolute. If not, prepend the experiment run directory
if not os.path.isabs(log_path) and self.expander.experiment_run_dir not in log_path:
log_path = os.path.join(self.expander.experiment_run_dir, log_path)

if log_path not in files:
files[log_path] = self._new_file_dict()

Expand Down

0 comments on commit 6821cd3

Please sign in to comment.