-
Notifications
You must be signed in to change notification settings - Fork 9
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
567 improved arg handling #662
Conversation
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.
@lifflander
Looks about as left.
Re-mention of notable differences:
- Removal of several short-args
- VT termination on UNKNOWN VT-args (that is, arguments that are completely not valid for the build, such a requesting tracing when the build does not support tracing); the short-args which are removed now count as UNKNOWN.
- ..and a help message?
The Codacy issue on the overload is a false-positive (it's a bad rule, there should never be a "suggestion" to fix the type of an overload) and should be suppressed. I was not able to do so manually and there does not appear to be any comment-style disables.
Oh, hmm, hmm, conflicts what.. |
786cfdb
to
0182564
Compare
Rebased onto origin/develop. |
Codecov Report
@@ Coverage Diff @@
## develop #662 +/- ##
========================================
Coverage 80.58% 80.58%
========================================
Files 354 354
Lines 11136 11136
========================================
Hits 8974 8974
Misses 2162 2162
|
Well, Codacy is a [getting it wrong] thing here.. :| |
0182564
to
429c270
Compare
429c270
to
6cdeed2
Compare
@pnstickne This is my fault, but this has gotten delayed. Do we still want to merge this? Can you rebase it if so? |
6cdeed2
to
31bb849
Compare
- All banner, no runtime logic. Now has it's own little home.
- One function doing too much and mixing stuff. - Also fixes code to return 'exit code'; ie. 0 = success, other = exit.
- All arguments must be accounted for and correctly parsed. This mitigates "oops" cases when arguments are not correctly handled by appropriate domain. To supply MPI_Init args, use: `--vt_mpi_args mpiarg1 mpiarg2..` To supply user args (returned up through initialize): `-- userarg1 userarg2 ..` To switch back to VT args, use `--vt_args` - Also supports 'auto pass-through' args for historic reasons. That is, any arguments before a "--vt_*" arg or "--help" are automatically classified as a pass-through arguments. `1 2 3 --vt_no_color` is the same as `--vt_no_color -- 1 2 3` while `--vt_no_color 1 2 3` is invalid (left in vt-arg context). Most notable, short vt args like '-c' or '-q' do NOT initiate vt-arg mode and will subject to pass-through behavior. args mergeup
- VT now terminates immediately on non-accounted-for arguments; and when --help is requested. Before args could be 'like whatever' and the help banner just flew through the terminal. - Mitigates / controls some of arg-ref behavior, builds a clean MPI_Init argument set, and removes confusing user_argc/user_argv. - Uses the new exposed prog_name which is also guaranteed to no contain extra pathing info..
- Banner message includes additional useful information about arguments that are passed downsteam. Arguments passed downsteam are not used by VT and coupled with the stricter argument checking.. should be more friendly! - Banner includes the program name (just-file-name and any more complete path passed down from mpirun).
- A little bit of shifting now to help a little bit more in the future.
- All calls now go through sync(), instead of some through there and some through MPI_Barrier.
- If any more is added, it should be skipped as parsing has been trivially rejected at the lower level. (In the future there may be more immediate post-parsing actions.)
- Now generates an MPI_Init/MPI_Abort sandwich to ensure basic contract of MPI. Output is only emitted during these times; the programs still terminate immediately thereafter.
- Help is now "--vt_help" - Removed short -c/-n/-q options for output. Use the full names like "--vt_quiet" instead.
- To avoid excessive spam, only the first node now emits a message. The responsibility is also pushed out. If the abort was caused by "help" the message is now written to stdout (instead of stderr) and the result code is 0. This is more uniform with many CLI utilities as the displaying of the help message, which was requested, is successful.
- Now the parsing and configuration are separate types, even if still sharing the same cc file for declarations. The primary reason is to reduce header-bleed of implementation related types (such as vector<int,string>). This also force uniform access to ArgConfig for all.. Also makes future non-static conversion of ArgParse much more.. lucrative. (eg. supply result message as member instead of returning outward)
- Added description and synopsis covering argument modes, switching between modes, and usages of such.. - Also unifies naming including that in banner messages. - "VT args" - used by VT configuration; --vt_* - "Application args" - supplied down-stream as argv - "MPI args" - used for MPI Init
- std::_Exit is a little more 'abrupt' than C's exit in that it does less flushing and will not call registered at-exit's.. I guess, consistency is better? Maybe.
31bb849
to
c50c524
Compare
Issues
======
+ Solved 1
- Added 1
See the complete overview on Codacy |
return app.exit(ex); | ||
class VtFormatter : public CLI::Formatter { | ||
public: | ||
std::string make_usage(const CLI::App *, std::string name) const override { |
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.
Basically:
All arguments must be accounted for and correctly parsed.
This mitigates "oops" cases when arguments are not correctly
handled by appropriate domain.
To supply MPI_Init args (still does not address issue of late MPI_Init), use:
--vt_mpi_args mpiarg1 mpiarg2..
To supply user args (returned up through initialize):
-- userarg1 userarg2 ..
To switch back to VT args, use
--vt_args
Also supports 'auto pass-through' args for historic reasons.
That is, any arguments before a "--vt_" arg including "--vt_help"
are automatically classified as a pass-through arguments and any
"--vt_" or argument will implicitly switch into vt-arg mode.
1 2 3 --vt_no_color
is the same as--vt_no_color -- 1 2 3
while--vt_no_color 1 2 3
is invalid (left in vt-arg context where such are invalid).Most notable, short vt args like '-c' or '-q' do NOT initiate
vt-arg mode and will subject to pass-through behavior.
(Short args have been removed to avoid this edge-case.)
The syntax can also be extended indefinitely (although auto-mode only applies once at the start), for whatever use it may have:
1 --vt_no_color -- 2 --vt_args --vt_trace -- 3
is the same as1 2 3 --vt_no_color --vt_trace
and--vt_no_color --vt_trace -- 1 2 3
It is recommended that parameters that take values do so with the
--param=value
form.This addresses some PEBCAK errors locally and provides a base for some future changes with directory arg handling. There is a chance similar issues are accidentally encountered on other systems.
Pass-through arguments (and the program name) are displayed in the banner for clarity.
It is a "breaking" change in that some previously valid parameters invocations are not forbidden, ie. needing to use a
--
to switch out of vt-arg context. However changes required are an artifact of the parameters supplied during invocation (as opposed to requiring code changes).When in vt-arg context, unknown arguments will abort the program with an argument error.
The
--vt_help
(replaces--help
) parameter is also more useful (and program-aborting).Fixes #567