You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Jie Yu <yu...@gmail.com> on 2014/06/19 02:25:12 UTC
Review Request 22764: Simplified Operation to only handle logics at the
subprocess side.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/
-----------------------------------------------------------
Review request for mesos and Benjamin Hindman.
Bugs: MESOS-1511
https://issues.apache.org/jira/browse/MESOS-1511
Repository: mesos-git
Description
-------
See summary.
Diffs
-----
3rdparty/libprocess/3rdparty/stout/include/stout/operation.hpp PRE-CREATION
3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
src/Makefile.am b1b7d2d
src/launcher/launcher.hpp 35cdc69
src/launcher/launcher.cpp 872e2e8
src/launcher/main.cpp b497e98
src/tests/environment.cpp 005fc54
src/tests/launcher_tests.cpp e293cc5
Diff: https://reviews.apache.org/r/22764/diff/
Testing
-------
make check
Thanks,
Jie Yu
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/
-----------------------------------------------------------
(Updated June 25, 2014, 7:51 p.m.)
Review request for mesos and Benjamin Hindman.
Changes
-------
BenH's comments.
Bugs: MESOS-1511
https://issues.apache.org/jira/browse/MESOS-1511
Repository: mesos-git
Description
-------
See summary.
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/Makefile.am 3359907
3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
3rdparty/libprocess/3rdparty/stout/tests/subcommand_tests.cpp PRE-CREATION
src/Makefile.am 861aad2
src/launcher/launcher.hpp 35cdc69
src/launcher/launcher.cpp 872e2e8
src/launcher/main.cpp b497e98
src/tests/environment.cpp 21b9d1d
src/tests/launcher_tests.cpp e293cc5
Diff: https://reviews.apache.org/r/22764/diff/
Testing
-------
make check
Thanks,
Jie Yu
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Jie Yu <yu...@gmail.com>.
> On June 25, 2014, 4:33 p.m., Benjamin Hindman wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp, line 86
> > <https://reviews.apache.org/r/22764/diff/5/?file=616543#file616543line86>
> >
> > Just a thought: I'm not convinced that you might not sometimes want to see all of "your" argc and argv (where I define "your" as being everything after argv[0] and argv[1]). We've seen this in our code base too, see the mesos-executor.
> >
> > Really what we're saving Subcommand writers is the three lines to do flags.load() and check for an error by not passing them their argc and argv.
Just checked the 'override' code in mesos-executor. Yeah, I agree that in some cases we need to access argc and argv in 'execute()'. However, I still wanna keeps the common flags parsing part as it is right now since in most of the cases, we don't need to access argc and argv.
I've added a TODO here (feel lazy to change all the dependent patches). We can have something like this in the future:
virtual int execute() = 0;
// Default behavior is to call execute(). User can override this to provide customized flags parsing.
virtual int execute(int argc, char** argv)
{
// Parsing flags using argc and argv
Try<Nothing> load = getFlags()->load(...);
...
return execute();
}
> On June 25, 2014, 4:33 p.m., Benjamin Hindman wrote:
> > 3rdparty/libprocess/src/tests/subprocess_tests.cpp, line 543
> > <https://reviews.apache.org/r/22764/diff/5/?file=616544#file616544line543>
> >
> > We should have an independent Subprocess Flags test and a SubcommandTest so we don't conflate the two. Seems like you could define/declare TestSubcommand::Flags outside of TestSubcommand (as it originally was done) but still use it in TestSubcommand. Moreover, you could define a helper that sets up these Flags that gets used both by the original test and the SubcommandTest so that you don't have to duplicate the code.
Added SubcommandTest in stout separately.
- Jie
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/#review46639
-----------------------------------------------------------
On June 25, 2014, 6:37 a.m., Jie Yu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22764/
> -----------------------------------------------------------
>
> (Updated June 25, 2014, 6:37 a.m.)
>
>
> Review request for mesos and Benjamin Hindman.
>
>
> Bugs: MESOS-1511
> https://issues.apache.org/jira/browse/MESOS-1511
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> See summary.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
> 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
> 3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
> src/Makefile.am 861aad2
> src/launcher/launcher.hpp 35cdc69
> src/launcher/launcher.cpp 872e2e8
> src/launcher/main.cpp b497e98
> src/tests/environment.cpp 21b9d1d
> src/tests/launcher_tests.cpp e293cc5
>
> Diff: https://reviews.apache.org/r/22764/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Jie Yu
>
>
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Benjamin Hindman <be...@berkeley.edu>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/#review46639
-----------------------------------------------------------
Ship it!
Cool stuff. Can you split this out into stout and Mesos commits? Don't worry about creating new reviews for them though.
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82168>
Just a thought: I'm not convinced that you might not sometimes want to see all of "your" argc and argv (where I define "your" as being everything after argv[0] and argv[1]). We've seen this in our code base too, see the mesos-executor.
Really what we're saving Subcommand writers is the three lines to do flags.load() and check for an error by not passing them their argc and argv.
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82148>
Let's use _ suffix for either all instance members or none please.
3rdparty/libprocess/src/tests/subprocess_tests.cpp
<https://reviews.apache.org/r/22764/#comment82152>
We should have an independent Subprocess Flags test and a SubcommandTest so we don't conflate the two. Seems like you could define/declare TestSubcommand::Flags outside of TestSubcommand (as it originally was done) but still use it in TestSubcommand. Moreover, you could define a helper that sets up these Flags that gets used both by the original test and the SubcommandTest so that you don't have to duplicate the code.
- Benjamin Hindman
On June 25, 2014, 6:37 a.m., Jie Yu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22764/
> -----------------------------------------------------------
>
> (Updated June 25, 2014, 6:37 a.m.)
>
>
> Review request for mesos and Benjamin Hindman.
>
>
> Bugs: MESOS-1511
> https://issues.apache.org/jira/browse/MESOS-1511
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> See summary.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
> 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
> 3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
> src/Makefile.am 861aad2
> src/launcher/launcher.hpp 35cdc69
> src/launcher/launcher.cpp 872e2e8
> src/launcher/main.cpp b497e98
> src/tests/environment.cpp 21b9d1d
> src/tests/launcher_tests.cpp e293cc5
>
> Diff: https://reviews.apache.org/r/22764/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Jie Yu
>
>
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/
-----------------------------------------------------------
(Updated June 25, 2014, 6:37 a.m.)
Review request for mesos and Benjamin Hindman.
Changes
-------
BenM's comments.
Bugs: MESOS-1511
https://issues.apache.org/jira/browse/MESOS-1511
Repository: mesos-git
Description
-------
See summary.
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
src/Makefile.am 861aad2
src/launcher/launcher.hpp 35cdc69
src/launcher/launcher.cpp 872e2e8
src/launcher/main.cpp b497e98
src/tests/environment.cpp 21b9d1d
src/tests/launcher_tests.cpp e293cc5
Diff: https://reviews.apache.org/r/22764/diff/
Testing
-------
make check
Thanks,
Jie Yu
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Jie Yu <yu...@gmail.com>.
> On June 25, 2014, 1:26 a.m., Ben Mahler wrote:
> > Make sure to split apart this change across mesos / libprocess / stout.
> >
> > At first I thought that this might belong more in mesos than in stout, but I see the utility of this now that I understand it better. I think the documentation could describe more about what this is to be used for rather than how it is to be used.
> >
> > I can take this from benh if he does not have time to review this.
Thanks Ben! I'll split them when committing.
> On June 25, 2014, 1:26 a.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp, lines 27-32
> > <https://reviews.apache.org/r/22764/diff/4/?file=614726#file614726line27>
> >
> > Do we want to say subprocess? Seems like the implementation doesn't require that?
> >
> > Also subcommand implies a command, the command in this context is the binary that leverages the subcommand abstraction?
> >
> > I think we need to emphasize more on what this is to be used for. Here's a little blurb that might be useful?
> >
> > "
> > Subcommand is an abstraction for creating command binaries that encompass many subcommands. For example:
> >
> > ./runner start --later
> > ./runner stop --now
> >
> > Here, the 'runner' command contains two Subcommand implementations, e.g. StartCommand and StopCommand.
> > "
Done. Thanks for the suggestion!
> On June 25, 2014, 1:26 a.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp, lines 76-77
> > <https://reviews.apache.org/r/22764/diff/4/?file=614726#file614726line76>
> >
> > Instead of requiring an override, could we have a 'name' argument in the Subcommand constructor and use that as a member or a non-virtual 'name' method?
Done. I like that.
> On June 25, 2014, 1:26 a.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp, lines 83-85
> > <https://reviews.apache.org/r/22764/diff/4/?file=614726#file614726line83>
> >
> > Should this just be s/getFlags/flags/ similar to how you named 'name()'?
Hum, we choose to use this name because the user might very likely define a public 'flags' field which will then conflict with flags().
> On June 25, 2014, 1:26 a.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp, line 142
> > <https://reviews.apache.org/r/22764/diff/4/?file=614726#file614726line142>
> >
> > Do we want to check for duplicate names?
Done.
> On June 25, 2014, 1:26 a.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp, line 145
> > <https://reviews.apache.org/r/22764/diff/4/?file=614726#file614726line145>
> >
> > Don't you need to shift the argv array before you pass it for flag loading? Seems like you don't want to pass the 'subcommand' part of argv.
It's OK. It'll just be ignored.
- Jie
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/#review46596
-----------------------------------------------------------
On June 21, 2014, 4:53 a.m., Jie Yu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22764/
> -----------------------------------------------------------
>
> (Updated June 21, 2014, 4:53 a.m.)
>
>
> Review request for mesos and Benjamin Hindman.
>
>
> Bugs: MESOS-1511
> https://issues.apache.org/jira/browse/MESOS-1511
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> See summary.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
> 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
> 3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
> src/Makefile.am fd2c80f
> src/launcher/launcher.hpp 35cdc69
> src/launcher/launcher.cpp 872e2e8
> src/launcher/main.cpp b497e98
> src/tests/environment.cpp 21b9d1d
> src/tests/launcher_tests.cpp e293cc5
>
> Diff: https://reviews.apache.org/r/22764/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Jie Yu
>
>
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Jie Yu <yu...@gmail.com>.
> On June 25, 2014, 1:26 a.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp, line 145
> > <https://reviews.apache.org/r/22764/diff/4/?file=614726#file614726line145>
> >
> > Don't you need to shift the argv array before you pass it for flag loading? Seems like you don't want to pass the 'subcommand' part of argv.
>
> Jie Yu wrote:
> It's OK. It'll just be ignored.
In fact, I changed it to flags->load(prefix, argc - 1, argv + 1);
- Jie
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/#review46596
-----------------------------------------------------------
On June 21, 2014, 4:53 a.m., Jie Yu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22764/
> -----------------------------------------------------------
>
> (Updated June 21, 2014, 4:53 a.m.)
>
>
> Review request for mesos and Benjamin Hindman.
>
>
> Bugs: MESOS-1511
> https://issues.apache.org/jira/browse/MESOS-1511
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> See summary.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
> 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
> 3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
> src/Makefile.am fd2c80f
> src/launcher/launcher.hpp 35cdc69
> src/launcher/launcher.cpp 872e2e8
> src/launcher/main.cpp b497e98
> src/tests/environment.cpp 21b9d1d
> src/tests/launcher_tests.cpp e293cc5
>
> Diff: https://reviews.apache.org/r/22764/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Jie Yu
>
>
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/#review46596
-----------------------------------------------------------
Make sure to split apart this change across mesos / libprocess / stout.
At first I thought that this might belong more in mesos than in stout, but I see the utility of this now that I understand it better. I think the documentation could describe more about what this is to be used for rather than how it is to be used.
I can take this from benh if he does not have time to review this.
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82087>
Do we want to say subprocess? Seems like the implementation doesn't require that?
Also subcommand implies a command, the command in this context is the binary that leverages the subcommand abstraction?
I think we need to emphasize more on what this is to be used for. Here's a little blurb that might be useful?
"
Subcommand is an abstraction for creating command binaries that encompass many subcommands. For example:
./runner start --later
./runner stop --now
Here, the 'runner' command contains two Subcommand implementations, e.g. StartCommand and StopCommand.
"
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82086>
Instead of requiring an override, could we have a 'name' argument in the Subcommand constructor and use that as a member or a non-virtual 'name' method?
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82085>
Should this just be s/getFlags/flags/ similar to how you named 'name()'?
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82082>
This seems like an odd way for this error to manifest, is this something that the caller should be aware of instead of being printed out to the end user?
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82081>
return 0?
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82080>
Do we want to check for duplicate names?
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp
<https://reviews.apache.org/r/22764/#comment82084>
Don't you need to shift the argv array before you pass it for flag loading? Seems like you don't want to pass the 'subcommand' part of argv.
- Ben Mahler
On June 21, 2014, 4:53 a.m., Jie Yu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22764/
> -----------------------------------------------------------
>
> (Updated June 21, 2014, 4:53 a.m.)
>
>
> Review request for mesos and Benjamin Hindman.
>
>
> Bugs: MESOS-1511
> https://issues.apache.org/jira/browse/MESOS-1511
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> See summary.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
> 3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
> 3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
> src/Makefile.am fd2c80f
> src/launcher/launcher.hpp 35cdc69
> src/launcher/launcher.cpp 872e2e8
> src/launcher/main.cpp b497e98
> src/tests/environment.cpp 21b9d1d
> src/tests/launcher_tests.cpp e293cc5
>
> Diff: https://reviews.apache.org/r/22764/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Jie Yu
>
>
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/
-----------------------------------------------------------
(Updated June 21, 2014, 4:53 a.m.)
Review request for mesos and Benjamin Hindman.
Changes
-------
Added a missing include.
Bugs: MESOS-1511
https://issues.apache.org/jira/browse/MESOS-1511
Repository: mesos-git
Description
-------
See summary.
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
src/Makefile.am fd2c80f
src/launcher/launcher.hpp 35cdc69
src/launcher/launcher.cpp 872e2e8
src/launcher/main.cpp b497e98
src/tests/environment.cpp 21b9d1d
src/tests/launcher_tests.cpp e293cc5
Diff: https://reviews.apache.org/r/22764/diff/
Testing
-------
make check
Thanks,
Jie Yu
Re: Review Request 22764: Renamed and simplified Subcommand to only handle
subprocess side of the logic.
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/
-----------------------------------------------------------
(Updated June 20, 2014, 9:55 p.m.)
Review request for mesos and Benjamin Hindman.
Changes
-------
Renamed to Subcommand per our discussion.
Summary (updated)
-----------------
Renamed and simplified Subcommand to only handle subprocess side of the logic.
Bugs: MESOS-1511
https://issues.apache.org/jira/browse/MESOS-1511
Repository: mesos-git
Description
-------
See summary.
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
3rdparty/libprocess/3rdparty/stout/include/stout/subcommand.hpp PRE-CREATION
3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
src/Makefile.am b1b7d2d
src/launcher/launcher.hpp 35cdc69
src/launcher/launcher.cpp 872e2e8
src/launcher/main.cpp b497e98
src/tests/environment.cpp 21b9d1d
src/tests/launcher_tests.cpp e293cc5
Diff: https://reviews.apache.org/r/22764/diff/
Testing
-------
make check
Thanks,
Jie Yu
Re: Review Request 22764: Simplified Operation to only handle logics at the
subprocess side.
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22764/
-----------------------------------------------------------
(Updated June 19, 2014, 4:09 p.m.)
Review request for mesos and Benjamin Hindman.
Changes
-------
Added to the Makefile.
Bugs: MESOS-1511
https://issues.apache.org/jira/browse/MESOS-1511
Repository: mesos-git
Description
-------
See summary.
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/Makefile.am eac7ab5
3rdparty/libprocess/3rdparty/stout/include/stout/operation.hpp PRE-CREATION
3rdparty/libprocess/src/tests/subprocess_tests.cpp 7dfa384
src/Makefile.am b1b7d2d
src/launcher/launcher.hpp 35cdc69
src/launcher/launcher.cpp 872e2e8
src/launcher/main.cpp b497e98
src/tests/environment.cpp 005fc54
src/tests/launcher_tests.cpp e293cc5
Diff: https://reviews.apache.org/r/22764/diff/
Testing
-------
make check
Thanks,
Jie Yu