[jira] [Commented] (MESOS-3035) As a Developer I would like a standard way to run a Subprocess in libprocess
[ https://issues.apache.org/jira/browse/MESOS-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15095418#comment-15095418 ] Kapil Arya commented on MESOS-3035: --- There has been no activity for a while so I am going to remove the target version for now. Please retarget to 0.28.0 or as appropriate. > As a Developer I would like a standard way to run a Subprocess in libprocess > > > Key: MESOS-3035 > URL: https://issues.apache.org/jira/browse/MESOS-3035 > Project: Mesos > Issue Type: Story > Components: libprocess >Reporter: Marco Massenzio > Labels: mesosphere, tech-debt > > As part of MESOS-2830 and MESOS-2902 I have been researching the ability to > run a {{Subprocess}} and capture the {{stdout / stderr}} along with the exit > status code. > {{process::subprocess()}} offers much of the functionality, but in a way that > still requires a lot of handiwork on the developer's part; we would like to > further abstract away the ability to just pass a string, an optional set of > command-line arguments and then collect the output of the command (bonus: > without blocking). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (MESOS-3035) As a Developer I would like a standard way to run a Subprocess in libprocess
[ https://issues.apache.org/jira/browse/MESOS-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15095472#comment-15095472 ] Marco Massenzio commented on MESOS-3035: Thanks, [~karya]. There has actually been plenty of "activity" on the review itself - but that ended up being discarded. I think [~jieyu] has done something similar in another review (I have no longer access to that email thread, I'm afraid) so he may be able to chime in. For myself, I've implemented the ["wrapper" class|https://github.com/massenz/execute-module/blob/develop/src/include/cmdexecute.hpp#L28] for {{Subprocess}} in my own module, so the "boilerplate" has been eliminated. As the original "reporter" for the issue, I'm happy for this to be closed as a "won't fix" - or we can keep it "open" if others think it's still worth pursuing in the future. > As a Developer I would like a standard way to run a Subprocess in libprocess > > > Key: MESOS-3035 > URL: https://issues.apache.org/jira/browse/MESOS-3035 > Project: Mesos > Issue Type: Story > Components: libprocess >Reporter: Marco Massenzio > Labels: mesosphere, tech-debt > > As part of MESOS-2830 and MESOS-2902 I have been researching the ability to > run a {{Subprocess}} and capture the {{stdout / stderr}} along with the exit > status code. > {{process::subprocess()}} offers much of the functionality, but in a way that > still requires a lot of handiwork on the developer's part; we would like to > further abstract away the ability to just pass a string, an optional set of > command-line arguments and then collect the output of the command (bonus: > without blocking). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (MESOS-3035) As a Developer I would like a standard way to run a Subprocess in libprocess
[ https://issues.apache.org/jira/browse/MESOS-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14697739#comment-14697739 ] Marco Massenzio commented on MESOS-3035: Hey [~pbrett] - I was looking at your [r/37045|https://reviews.apache.org/r/37045] and thought great minds think alike :) Can you please take a quick view at what I've done in the review posted (above) and let me know whether the refactoring in {{Subprocess}} would help your use case (and, also, if you can spot where I went wrong? there is something, when the thing times out, I believe, that causes a SIGABRT - but still the tests, weirdly, pass). Thanks! As a Developer I would like a standard way to run a Subprocess in libprocess Key: MESOS-3035 URL: https://issues.apache.org/jira/browse/MESOS-3035 Project: Mesos Issue Type: Story Components: libprocess Reporter: Marco Massenzio Assignee: Marco Massenzio As part of MESOS-2830 and MESOS-2902 I have been researching the ability to run a {{Subprocess}} and capture the {{stdout / stderr}} along with the exit status code. {{process::subprocess()}} offers much of the functionality, but in a way that still requires a lot of handiwork on the developer's part; we would like to further abstract away the ability to just pass a string, an optional set of command-line arguments and then collect the output of the command (bonus: without blocking). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (MESOS-3035) As a Developer I would like a standard way to run a Subprocess in libprocess
[ https://issues.apache.org/jira/browse/MESOS-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14647885#comment-14647885 ] Marco Massenzio commented on MESOS-3035: When reviewing the code in [r/36425|https://reviews.apache.org/r/36425/] [~benjaminhindman] noticed that there is a better abstraction that is possible to introduce for {{os::shell()}} that will simplify the caller's life. Instead of having to handle all possible outcomes, we propose to refactor {{os::shell()}} as follows: {code} /** * Returns the output from running the specified command with the shell. */ Trystd::string shell(const string command) { // Actually handle the WIFEXITED, WIFSIGNALED here! } {code} where the returned string is {{stdout}} and, should the program be signaled, or exit with a non-zero exit code, we will simply return a {{Failure}} with an error message that will encapsulate both the returned/signaled state, and, possibly {{stderr}}. And some test driven development: {code} EXPECT_ERROR(os::shell(false)); EXPECT_SOME(os::shell(true)); EXPECT_SOME_EQ(hello world, os::shell(echo hello world)); {code} Alternatively, the caller can ask to have {{stderr}} conflated with {{stdout}}: {code} Trystring outAndErr = os::shell(myCmd --foo 21); {code} However, {{stderr}} will be ignored by default: {code} // We don't read standard error by default. EXPECT_SOME_EQ(, os::shell(echo hello world 12)); // We don't even read stderr if something fails (to return in Try::error). Trystring output = os::shell(echo hello world 12 false); EXPECT_ERROR(output); EXPECT_FALSE(strings::contains(output.error(), hello world)); {code} An analysis of existing usage shows that in almost all cases, the caller only cares {{if not error}}; in fact, the actual exit code is read only once, and even then, in a test case. We believe this will simplify the API to the caller, and will significantly reduce the length and complexity at the calling sites (6 LOC against the current 20+). As a Developer I would like a standard way to run a Subprocess in libprocess Key: MESOS-3035 URL: https://issues.apache.org/jira/browse/MESOS-3035 Project: Mesos Issue Type: Story Components: libprocess Reporter: Marco Massenzio Assignee: Marco Massenzio As part of MESOS-2830 and MESOS-2902 I have been researching the ability to run a {{Subprocess}} and capture the {{stdout / stderr}} along with the exit status code. {{process::subprocess()}} offers much of the functionality, but in a way that still requires a lot of handiwork on the developer's part; we would like to further abstract away the ability to just pass a string, an optional set of command-line arguments and then collect the output of the command (bonus: without blocking). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (MESOS-3035) As a Developer I would like a standard way to run a Subprocess in libprocess
[ https://issues.apache.org/jira/browse/MESOS-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14630375#comment-14630375 ] Paul Brett commented on MESOS-3035: --- Removed MESOS-2834 as a dependent by implementing a revised version of this code. [~marco-mesos] you might want to take a look at https://reviews.apache.org/r/36378 to see what I was thinking. As a Developer I would like a standard way to run a Subprocess in libprocess Key: MESOS-3035 URL: https://issues.apache.org/jira/browse/MESOS-3035 Project: Mesos Issue Type: Story Components: libprocess Reporter: Marco Massenzio Assignee: Marco Massenzio As part of MESOS-2830 and MESOS-2902 I have been researching the ability to run a {{Subprocess}} and capture the {{stdout / stderr}} along with the exit status code. {{process::subprocess()}} offers much of the functionality, but in a way that still requires a lot of handiwork on the developer's part; we would like to further abstract away the ability to just pass a string, an optional set of command-line arguments and then collect the output of the command (bonus: without blocking). -- This message was sent by Atlassian JIRA (v6.3.4#6332)