Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override yatm model class method for prior restarts #531

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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():
aidanheerdegen marked this conversation as resolved.
Show resolved Hide resolved
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 == []
Loading