payu-org / payu

A workflow management tool for numerical models on the NCI computing systems
Apache License 2.0
21 stars 27 forks source link

Support symbolic links to configuration files #450

Closed aidanheerdegen closed 1 month ago

aidanheerdegen commented 5 months ago

For ACCESS models it would be convenient to have a number of possible pre-set diagnostic output profiles and use symbolic links to select the desired output profile.

Currently this is not supported correctly with payu. Configuration files are copied into the work directory here

https://github.com/payu-org/payu/blob/master/payu/models/model.py#L234

and

https://github.com/payu-org/payu/blob/master/payu/models/model.py#L239

According to the documentation of the shutil.copy function this will copy a symbolic link rather than the file it points to.

This is undesirable behaviour for payu: if it is a symbolic link we want a copy of the file in work. This can be achieved by adding the follow_symlinks=True option to the copy command.

jo-basevi commented 3 months ago

I think follow_symlink=True is the default value for shutil.copy? I only noticed it when I was writing a test that would reproduce this bug, and it passed the test with no changes..