Skip to content

Commit

Permalink
Moved bracket and renamed test restart locations
Browse files Browse the repository at this point in the history
  • Loading branch information
Whyborn committed Sep 18, 2024
1 parent 03f43c3 commit 864aa7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions payu/models/staged_cable.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

# Local
from payu.models.model import Model
from payu.fsops import mkdir_p


def deep_update(d_1, d_2):
Expand Down Expand Up @@ -134,7 +135,7 @@ def setup(self):
super(StagedCable, self).setup()

# Make the logging directory
mkdir_p(os.path.join(self.work_path), "logs")
mkdir_p(os.path.join(self.work_path, "logs"))

# Build the namelists for the stage
self._prepare_stage()
Expand Down Expand Up @@ -232,7 +233,7 @@ def archive(self):

self._save_configuration_log()

if len(configuration_log["queued_stages"]) == 0:
if len(self.configuration_log["queued_stages"]) == 0:
os.remove('configuration_log.yaml')

super(StagedCable, self).archive()
Expand Down
14 changes: 7 additions & 7 deletions test/models/test_staged_cable.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,23 @@ def test_staged_cable():
model.archive()

# When running an experiment, we should have archive/output00{0, 1}/restart
outputdir = ctrldir / 'archive' / 'output000' / 'restart'
outputdir = ctrldir / 'archive' / 'restart000' / 'restart'
outputdir.mkdir(parents=True)
with open(outputdir / 'rst1.txt', 'w') as rstfile:
rstfile.write("This is rst1.txt in output000.")
rstfile.write("This is rst1.txt in restart000.")

with open(outputdir / 'rst2.txt', 'w') as rstfile:
rstfile.write("This is rst2.txt in output000.")
rstfile.write("This is rst2.txt in restart000.")

outputdir = ctrldir / 'archive' / 'output001' / 'restart'
outputdir = ctrldir / 'archive' / 'restart001' / 'restart'
outputdir.mkdir(parents=True)
with open(outputdir / 'rst1.txt', 'w') as rstfile:
rstfile.write('This is rst1.txt in output001.')
rstfile.write('This is rst1.txt in restart001.')

rstfiles = model.get_prior_restart_files()
expected_restart_files = [
str(ctrldir / 'archive' / 'output001' / 'restart' / 'rst1.txt'),
str(ctrldir / 'archive' / 'output000' / 'restart' / 'rst2.txt')
str(ctrldir / 'archive' / 'restart001' / 'restart' / 'rst1.txt'),
str(ctrldir / 'archive' / 'restart000' / 'restart' / 'rst2.txt')
]

assert rstfiles == expected_restart_files

0 comments on commit 864aa7f

Please sign in to comment.