Skip to content

Commit

Permalink
fixup! Redirect prints from Spack to log file
Browse files Browse the repository at this point in the history
  • Loading branch information
dapomeroy committed Sep 13, 2023
1 parent e6d9a6b commit c6975b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/ramble/ramble/test/cmd/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ def test_dryrun_setup():

workspace('setup', '--dry-run', global_args=['-w', workspace_name])

out_files = glob.glob(os.path.join(ws1.workspace_log_dir, '**', '*.out'), recursive=True)
out_files = glob.glob(os.path.join(ws1.log_dir, '**', '*.out'), recursive=True)

assert search_files_for_string(out_files, 'Would download file:///tmp/test_file.log')
# assert "Would download file:///tmp/test_file.log" in output
Expand Down
9 changes: 4 additions & 5 deletions lib/ramble/ramble/workspace/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,20 +1100,19 @@ def run_pipeline(self, pipeline, phases='*'):
# or when dry_run is TRUE, which will echo all output to screen.

# Check that the workspace log directory exists
self.workspace_log_dir = os.path.join(self.root, workspace_log_path)
if not os.path.exists(self.workspace_log_dir):
os.makedirs(self.workspace_log_dir)
if not os.path.exists(self.log_dir):
os.makedirs(self.log_dir)

# Set up a log file for the overall pipeline, excluding experiments
dt = self._date_string()
inner_delim = '.'
pipeline_log_base = pipeline + inner_delim + dt
pipeline_log_file = pipeline_log_base + '.out'
pipeline_log_path = os.path.join(self.workspace_log_dir, pipeline_log_file)
pipeline_log_path = os.path.join(self.log_dir, pipeline_log_file)
pipeline_log_stream = open(pipeline_log_path, 'a+')

# Set up a directory to contain a log for each experiment
self.experiment_log_dir = os.path.join(self.workspace_log_dir, pipeline_log_base)
self.experiment_log_dir = os.path.join(self.log_dir, pipeline_log_base)
if not os.path.exists(self.experiment_log_dir):
os.makedirs(self.experiment_log_dir)

Expand Down

0 comments on commit c6975b1

Please sign in to comment.