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

Add error handling for payu checkout with non-writable laboratory #528

Closed jo-basevi closed 1 month ago

jo-basevi commented 1 month ago

This PR:

I was running with the idea of checking out a git branch - running checks on that branch and then if they failed, reverting the checkout back to the previous branch (and delete any new branches that were created). Though I then finally realised that it would make it difficult for the user to apply fixes on the branch/tag/commit they were starting from, e.g. fix project/shortpath/laboratory in config.yaml. It would require adding command-line args to payu clone/checkout that will require modifications to config.yaml.

There is the pre-existing --laboratory command-line flag to payu clone/checkout. It doesn't modify the config.yaml so will either need to be passed to subsequent payu commands or shortpath/laboratory/project options will need to modified manually in config.yaml.

I initialised laboratory directories (using mkdir_p) rather just checking for write access using os.access, so it wouldn't fail when a laboratory base directory does not exist but it can be created by a user. I added laboratory specific error messaging to Laboratory class method, and also call laboratory.initialize() in Experiment() as when running payu setup/sweep/run it would be good to know first thing if the laboratory directory is even writable.

Closes #524

pep8speaks commented 1 month ago

Hello @jo-basevi! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2024-10-14 04:07:28 UTC
coveralls commented 1 month ago

Coverage Status

coverage: 58.517% (+0.2%) from 58.29% when pulling ba95e0148d79b274a85ae7d802b06fbaa8c8fb8a on ACCESS-NRI:524-Checkout-project-error-bug into 1186c46e47866468f4e56ed74a578d83ffcee0e0 on payu-org:master.