cmdstan icon indicating copy to clipboard operation
cmdstan copied to clipboard

diagnose exit code

Open jsks opened this issue 1 year ago • 3 comments
trafficstars

Currently, the diagnose utility prints all output to stdout and returns 0 regardless of warnings. Would it make sense to return a non-zero exit status if there's an error with any of the checks?

This would make it easier to programmatically distinguish CmdStan runs with diagnostic warnings in the shell. As far as I know, currently the diagnose output needs to be checked manually or the output loaded into one of the programming language specific packages.

The return line in diagnose.cpp can just return the bool value from the variable has_error, or a more specific exit code can be used.

jsks avatar May 30 '24 09:05 jsks

the diagnose command detects potential errors - it returns warnings. however, your point is valid - the return code could be used to signal warnings / no_warnings.

regarding the diagnose utility - I think that it's probably due for updates - it was written circa 2016 and reflects the thinking then. cf https://discourse.mc-stan.org/t/is-the-diagnose-utility-deprecated/2312. there are a bunch of case studies by Michael Betancourt on these diagnostics. also, some discussion in the "Visualization in Bayesian Workflow" paper of Gabry et al - https://arxiv.org/abs/1709.01449

mitzimorris avatar May 30 '24 12:05 mitzimorris

I think it would make sense to something similar to grep:

0 - no problem 1 - warning raised 2 - internal error/exception, not a problem with this specific set of draws

WardBrian avatar May 30 '24 13:05 WardBrian

Sorry, misread the original issue

WardBrian avatar Nov 04 '24 14:11 WardBrian