Skip to content

Commit

Permalink
simlink log files to allow for known latest path
Browse files Browse the repository at this point in the history
  • Loading branch information
rfbgo committed Oct 10, 2023
1 parent b1d84b4 commit 2e4ab42
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/ramble/ramble/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,19 @@ def __init__(self, workspace, filters):
log_file = f'{self.name}.{dt}.out'
self.log_dir = os.path.join(self.workspace.log_dir,
f'{self.name}.{dt}')
self.log_dir_latest = os.path.join(self.workspace.log_dir,
f'{self.name}.latest')
self.log_path = os.path.join(self.workspace.log_dir,
log_file)
self.log_path_latest = os.path.join(self.workspace.log_dir,
f'{self.name}.latest.out')

fs.mkdirp(self.log_dir)

# Create simlinks to give known paths
self.simlink_log(self.log_dir, self.log_dir_latest)
self.simlink_log(self.log_path, self.log_path_latest)

self._experiment_set = workspace.build_experiment_set()
self._software_environments = ramble.software_environments.SoftwareEnvironments(workspace)
self.workspace.software_environments = self._software_environments
Expand Down Expand Up @@ -159,6 +168,15 @@ def run(self):
with self.workspace.logger(self.log_path, echo=self.workspace.dry_run):
self._complete()

def simlink_log(self, base, link):
"""
Create simlink of log file to give a known and predictable path
"""
if os.path.islink(link):
os.unlink(link)

os.symlink(base, link)


class AnalyzePipeline(Pipeline):
"""Class for the analyze pipeline"""
Expand Down

0 comments on commit 2e4ab42

Please sign in to comment.