-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print errors to stderr instead of stdout; don't nag for fixed_param
flag, just do it
#992
Conversation
…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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question about the return code on printing error message. Change of behavior for zero parameter model makes sense.
return err_code; | ||
} | ||
if (parser.help_printed()) | ||
return err_code; | ||
return stan::services::error_codes::OK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good!
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/test
Summary:
command.hpp
andmain.cpp
send error messages to cerr instead of coutsample
is specified, if model doesn't contain any parameters, run algorithmfixed_param
and print message to console. detect if model has no parameters and run fixed param sampler automatically #953USAGE
used 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: