Skip to content

Commit

Permalink
Merge 5822a60 into 70a3ce9
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanheerdegen committed May 19, 2020
2 parents 70a3ce9 + 5822a60 commit 43b77c5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
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

0 comments on commit 43b77c5

Please sign in to comment.