Skip to content

Commit

Permalink
Merge pull request #531 from ACCESS-NRI/523-yatm-get-prior-retart-files
Browse files Browse the repository at this point in the history
Override yatm model class method for prior restarts
  • Loading branch information
aidanheerdegen authored Oct 15, 2024
2 parents 2faf9e7 + 6143912 commit 7c885b8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
10 changes: 6 additions & 4 deletions payu/models/yatm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ def set_model_pathnames(self):
self.work_input_path = os.path.join(self.work_path, 'INPUT')

def archive(self):

# Create an empty restart directory
mkdir_p(self.restart_path)

shutil.rmtree(self.work_input_path)

def collate(self):
pass

def get_prior_restart_files(self):
"""Override model class method to avoid displaying an error
when there is no prior restart files. yatm reads from data files
so it should not require prior restarts"""
return []
21 changes: 21 additions & 0 deletions test/models/test_yatm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

from unittest.mock import Mock

import payu.experiment
import payu.models

def test_get_prior_restart_files(capsys, tmpdir):
with capsys.disabled():
expt = Mock(spec=payu.experiment.Experiment)
model_config = {'model': 'yatm'}
model = payu.models.Yatm(expt, 'atmosphere', model_config)
model.prior_restart_path = str(tmpdir / 'unexistent_dir')

restart_files = model.get_prior_restart_files()

# Check nothing written to standard output
captured = capsys.readouterr()
assert captured.out == ''
assert captured.err == ''

assert restart_files == []

0 comments on commit 7c885b8

Please sign in to comment.