payu-org / payu

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

Handling errors from user scripts #448

Open MartinDix opened 1 week ago

MartinDix commented 1 week ago

At the moment errors from user scripts just result in a pretty feeble warning message

https://github.com/payu-org/payu/blob/8a4a1e2e9171f01e37bd34bfd8bb6f209f550873/payu/experiment.py#L926

which is easily missed in a log file (and doesn't even seem to appear with https://github.com/ACCESS-NRI/access-esm1.5-configs/issues/22).

I think payu should raise an error instead.

aidanheerdegen commented 6 days ago

I think payu should raise an error instead.

Agreed. If a user doesn't want payu to abort they should catch errors in their scripts and deal with them, and return a non-error status.

MartinDix commented 5 days ago

The most appropriate of the standard exceptions seems to be RuntimeError.

As far as I can tell there are no tests of running scripts in the payu tests at the moment.

jo-basevi commented 5 days ago

Yeah RuntimeError does seem to make the most sense. I am starting on moving the logic for running user scripts out of the payu experiment class so it's easier to write some testing for it. This will also include testing for this userscript issue here: https://github.com/payu-org/payu/issues/444