-
Notifications
You must be signed in to change notification settings - Fork 181
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
Quit after command-line parses env var #2694
Conversation
@Lestropie @jdtournier this PR is ready for review if you have a moment |
…hat commands quit afte parsing the inputs (for use in CI)
to allow them to be called from the top-level namespace
quitting due to MRTRIX_PARSE_ONLY being set
f42483a
to
79044b0
Compare
NB: Just rebased it onto dev instead of master |
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.
Switched PR target branch to match rebasing to dev
.
- Currently early exit does not apply when running in an R environment. I don't know the extent to which that is used beyond the original implementer... nevertheless, given the definition and claimed implementation of the environment variable, it should probably be doing the same thing there also.
- Not sure if "parse only" is adequately descriptive. In the context of CLI / workflow engine, sure, but in the context of the software as a whole, maybe something more verbose like "CLI parse only"? @jdtournier?
Added support for Python commands that I had forgotten todo, renamed env var to MRTRIX_CLI_PARSE_ONLY. Which commands are R based? |
Not at all used as far as I know... I don't think the original implementer is even still working in the field! I've been meaning to remove support for R integration, it always felt like a bit of a hack. I'll work on that when I have a minute. But in the meantime, I really wouldn't worry a great deal about this! |
All C++ commands; see parallel functions in |
Ah, I misunderstood. You mean all mrtrix commands can be called from R, rather than R-based mrtrix commands. If it is an issue, we could just add a disclaimer that it won't work when calling from R, but it sounds like it will be dropped in any case. Is it good to merge now? Did you request a change somewhere in the code @Lestropie? Because I can't see where that is if so |
Given the absence of interest in the R interface, perhaps just clarify very briefly in the description for the new environment variable that it only applies to the shell interface and not to R? I've left a bunch of comments in the code, and you will need to resolve conflicts with latest |
Co-authored-by: Robert Smith <robert.smith@florey.edu.au>
Co-authored-by: Robert Smith <robert.smith@florey.edu.au>
Co-authored-by: Robert Smith <robert.smith@florey.edu.au>
…rom root namespace
@Lestropie Ok, I have made those changes now so I believe it should be good to re-review. Note that there is a difference in behaviour in the message printing between the c++ and python, i.e. it shows up by default in python commands but only when the -info flag is passed to c++ commands, but this seems to be the case with other "info" messages as well. (NB: I can't see the "1 change requested", do you know what that is referring to) |
Uh, I suggested calling function My intention was for nothing to be printed to
This comment was made as a review. It'll resolve once I re-review. |
Maybe the code could be refactored to use Python's std logger, which would give you the behaviour you are after, but that seems like a fair bit of work for not much gain.
This was my thinking with the warning, but in either case it probably isn't worth worrying about too much
|
Co-authored-by: Robert Smith <robert.smith@florey.edu.au>
Co-authored-by: Robert Smith <robert.smith@florey.edu.au>
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.
Only thing that still catches my eye is that if the contents of the envvar can't be converted to bool, the exception won't be handled neatly in C++. But realistically it's not an issue, this is a feature purely for developers anyway. So should be good to go from here.
This PR addresses #2679 by defining an environment variable ("MRTRIX_PARSE_ONLY"), which if set to "1", will cause all commands to terminate after successful completion of the command-line parsing with a "warning" stating that the CL args have been parsed successfully.
@Lestropie @jdtournier