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

Fix bug overwriting exe manifest on reproduce #267

Merged
merged 4 commits into from
May 19, 2020
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
17 changes: 10 additions & 7 deletions payu/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,16 @@ def setup(self):

# Make symlink to executable in work directory
if self.exec_path:
# Add to exe manifest (this is always done so any change in exe
# path will be picked up)
self.expt.manifest.add_filepath(
'exe',
self.exec_path_local,
self.exec_path
)
# If have exe manifest this implies exe reproduce is True. Do not
# want to overwrite exe manifest in this case
if not self.expt.manifest.have_manifest['exe']:
# Add to exe manifest (this is always done so any change in exe
# path will be picked up)
self.expt.manifest.add_filepath(
'exe',
self.exec_path_local,
self.exec_path
)

timestep = self.config.get('timestep')
if timestep:
Expand Down
19 changes: 19 additions & 0 deletions test/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,24 @@ def test_exe_reproduce():
# Check manifests have changed as expected
assert(not manifests == get_manifests(ctrldir/'manifests'))

# Reset manifests "truth"
manifests = get_manifests(ctrldir/'manifests')

# Make exe in config.yaml unfindable by giving it a non-existent
# path but crucially the same name as the proper executable
config['exe'] = '/bogus/test.exe'

# Change reproduce exe back to True
config['manifest']['reproduce']['exe'] = True

write_config(config)

# Run setup with changed exe but reproduce exe set to True. Should
# work fine as the exe path is in the manifest
payu_setup(lab_path=str(labdir))

assert(manifests == get_manifests(ctrldir/'manifests'))


def test_input_reproduce():

Expand All @@ -222,6 +240,7 @@ def test_input_reproduce():
# Set reproduce input to True
config['manifest']['reproduce']['exe'] = False
config['manifest']['reproduce']['input'] = True
config['exe'] = config_orig['exe']
write_config(config)
manifests = get_manifests(ctrldir/'manifests')

Expand Down