Print errors to stderr instead of stdout; don't nag for fixed_param flag, just do it#992
Print errors to stderr instead of stdout; don't nag for fixed_param flag, just do it#992
fixed_param flag, just do it#992Conversation
…unit tests to match
…4.1 (tags/RELEASE_600/final)
|
we'll need to advertise this change because folks might have scripts or packages that scrape stderr and/or stdout. I don't quite understand why services layer uses return codes plus callback writers; effectively, there are only two return codes: OK, not OK. plus whatever messages are written to stderr. |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
bbbales2
left a comment
There was a problem hiding this comment.
Question about the return code on printing error message. Change of behavior for zero parameter model makes sense.
| } | ||
| if (parser.help_printed()) | ||
| return err_code; | ||
| return stan::services::error_codes::OK; |
There was a problem hiding this comment.
It looks like rm sets an error code here, so maybe we should too?
$ rm
rm: missing operand
Try 'rm --help' for more information.
$ echo $?
1
There was a problem hiding this comment.
if you only supply 1 arg, by default we print help.
if you request help, we print help.
checked make - when in a directory which has a Makefile present,
if runs whatever the default Makefile rule is.
when in a directory without a Makefile, return code 2
when invoked with -h, prints help, return code 0.
There was a problem hiding this comment.
lines 136-137 are correct. changed line 128 - return code USAGE set when no args are given - this will result in help message being printed; and then program will exit. so if you get to line 136, user requested help to be printed, help was printed, all good. cf above example
|
@bbbales2 - thanks for the code review - made changes, ready for re-review. |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
|
I updated the pull request name so it'd be easier to remember to add a warning about this to the release notes. |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
fixed_param flag, just do it
Submisison Checklist
./runCmdStanTests.py src/testSummary:
command.hppandmain.cppsend error messages to cerr instead of coutsampleis specified, if model doesn't contain any parameters, run algorithmfixed_paramand print message to console. detect if model has no parameters and run fixed param sampler automatically #953USAGEused only for unrecognized command line args. printing usage message returns code isOK.Intended Effect:
make it easy for CmdStanX wrappers to report error messages via contents of stderr instead of making them scrape stdout.
How to Verify:
unit tests
Side Effects:
NA
Documentation:
NA
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Columbia University
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: