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

Need for absolute paths when doing a payu clone -r could be clearer #514

Open
anton-seaice opened this issue Sep 17, 2024 · 1 comment · May be fixed by #516
Open

Need for absolute paths when doing a payu clone -r could be clearer #514

anton-seaice opened this issue Sep 17, 2024 · 1 comment · May be fixed by #516
Assignees

Comments

@anton-seaice
Copy link
Collaborator

Doing a payu clone using a relative restart path doesn't work with a warning:

Cloned repository from om2 to directory: /g/data/tm70/as2285/payu/om2-clone-r
Checked out branch: om2_1deg_ryf
laboratory path:  /scratch/tm70/as2285/access-om2
binary path:  /scratch/tm70/as2285/access-om2/bin
input path:  /scratch/tm70/as2285/access-om2/input
work path:  /scratch/tm70/as2285/access-om2/work
archive path:  /scratch/tm70/as2285/access-om2/archive
/g/data/tm70/as2285/payu-dev/payu-dev/lib64/python3.11/site-packages/payu/branch.py:46: UserWarning: Given restart path om2/archive/restart000 does not exist. Skipping setting 'restart' in config file

...

As it relies on an absolute path

https://github.com/payu-org/payu/blob/master/payu/branch.py#L245-L246

This could be clearer in the docs and help, e.g.:

$ payu clone --help
usage: payu clone [-h] [--model MODEL_TYPE] [--config CONFIG_PATH] [--laboratory LAB_PATH] [-k] [--branch BRANCH] [--new-branch NEW_BRANCH_NAME] [--restart RESTART_PATH]
                  [--parent-experiment PARENT_EXPERIMENT]
                  repository local_directory
...
  --restart RESTART_PATH, -r RESTART_PATH
                        The restart path from which to start the model run
...

its also not clear to me why the relative path can't work?

@jo-basevi
Copy link
Collaborator

Thanks for raising this issue! Yeah relative paths should be supported..

So restart path is added to the configuration as part of the checkout method and is resolved to an absolute path:

restart_path = restart_path.resolve()

The error is happening because checkout runs inside the newly cloned directory. So the clone method could be changed to resolve the restart path before passing the path to checkout. The code documentation will need to be fixed too.

@jo-basevi jo-basevi linked a pull request Sep 18, 2024 that will close this issue
@jo-basevi jo-basevi self-assigned this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants