Repository: incubator-zeppelin Updated Branches: refs/heads/master 24e87a62f -> b50f438e9
ZEPPELIN-646: Shell interpreter output streaming ### What is this PR for? After #611 merged, Zeppelin provides streaming output for **spark** and **pyspark** interpreter. For the further improvement, I changed a few code lines using <code>[InterpreterContext](https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java#L66)</code> so that **sh** interpreter can be available too. ### What type of PR is it? Improvement ### Todos ### Is there a relevant Jira issue? [ZEPPELIN-646: Shell interpreter output streaming](https://issues.apache.org/jira/browse/ZEPPELIN-646) [ZEPPELIN-554: Streaming interpreter output to front-end]() ### How should this be tested? After applying this PR, run this below code with `sh` interpreter in Zeppelin. ``` date && sleep 3 && date ``` Then you can see two timestamps which have 3 seconds gap. ### Screenshots (if appropriate)  ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Ryu Ah young <[email protected]> Closes #683 from AhyoungRyu/ZEPPELIN-646 and squashes the following commits: a9d2e2b [Ryu Ah young] ZEPPELIN-646: Shell interpreter output streaming Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/b50f438e Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/b50f438e Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/b50f438e Branch: refs/heads/master Commit: b50f438e908a143bb2978010ca3bca9673322d8f Parents: 24e87a6 Author: Ryu Ah young <[email protected]> Authored: Tue Feb 2 18:25:20 2016 +0900 Committer: Jongyoul Lee <[email protected]> Committed: Tue Feb 9 14:14:01 2016 +0900 ---------------------------------------------------------------------- .../main/java/org/apache/zeppelin/shell/ShellInterpreter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/b50f438e/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java b/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java index 85aafc5..9a0434f 100644 --- a/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java +++ b/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java @@ -72,7 +72,7 @@ public class ShellInterpreter extends Interpreter { DefaultExecutor executor = new DefaultExecutor(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream errorStream = new ByteArrayOutputStream(); - executor.setStreamHandler(new PumpStreamHandler(outputStream, errorStream)); + executor.setStreamHandler(new PumpStreamHandler(contextInterpreter.out, errorStream)); executor.setWatchdog(new ExecuteWatchdog(commandTimeOut)); Job runningJob = getRunningJob(contextInterpreter.getParagraphId()); @@ -82,7 +82,7 @@ public class ShellInterpreter extends Interpreter { int exitVal = executor.execute(cmdLine); logger.info("Paragraph " + contextInterpreter.getParagraphId() + "return with exit value: " + exitVal); - return new InterpreterResult(InterpreterResult.Code.SUCCESS, outputStream.toString()); + return new InterpreterResult(InterpreterResult.Code.SUCCESS, null); } catch (ExecuteException e) { int exitValue = e.getExitValue(); logger.error("Can not run " + cmd, e); @@ -94,7 +94,7 @@ public class ShellInterpreter extends Interpreter { logger.info("The paragraph " + contextInterpreter.getParagraphId() + " stopped executing: " + msg); } - msg += "Exitvalue: " + exitValue; + msg += "ExitValue: " + exitValue; return new InterpreterResult(code, msg); } catch (IOException e) { logger.error("Can not run " + cmd, e);
