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

Payu checkout restart path error vs warning #529

Open jo-basevi opened 1 month ago

jo-basevi commented 1 month ago

Currently payu raises a warning when a restart path does not exist with payu clone/checkout -r <RESTART_PATH>.

https://github.com/payu-org/payu/blob/1186c46e47866468f4e56ed74a578d83ffcee0e0/payu/branch.py#L57-L61

However as the restart path is also used during metadata generation to check whether the restart parent directory contains a metadata.yaml and a experiment_uuid. If the UUID exists, it is used as value for the parent_experiment. metadata.yaml is only modified and committed when there's a new UUID, so rerunning payu checkout -r <restart_path> <CURRENT_BRANCH> or payu setup with a modified restart in config.yaml will not modify and commit the metadata file.

I wonder if restart path should be checked if it exists earlier in the clone/checkout methods before any git clone/checkout, and error out if restart path does not exist and suggest to the user to check/fix the -r <RESTART_PATH> value and re-run the clone/checkout.

Should an error also be raised when archive path contains restarts (currently a warning) as the -r <RESTART_PATH> does not do anything? This check can only happen once the git branch has been checked out and the metadata has been setup (need metadata methods to determine experiment name for archive paths). Also, if it's changed to an error from a warning, should the checkout be reverted?