Skip to content

Conversation

@Leemoonsoo
Copy link
Member

What is this PR for?

Output from interpreter is displayed after completion of paragraph execution.
It'll be useful if output can be streamed to front-end during execution.

Previous work #593 injects InterpreterOutput stream object to Interpreter.
This PR is based on #593 and stream the data from InterpreterOutput to front-end.

This implementation only streams output is %text. Other output type (%html, %angular, %table) is not streamed to the front end.

While this PR keeps backward compatibility, Interpreter who want to use this feature will need to modify code to write output into InterpreterOutput instead of return with InterpreterResult.

This PR includes modification of SparkInterpreter to use InterpreterOutput.

What type of PR is it?

Feature

Todos

Is there a relevant Jira issue?

https://issues.apache.org/jira/browse/ZEPPELIN-554

How should this be tested?

Run such code using Spark interpreter

(1 to 10).foreach{ i=>
    Thread.sleep(1000)
    println("Hello " + i)
}

Screenshots (if appropriate)

stream_output

Questions:

  • Does the licenses files need update? no
  • Is there breaking changes for older versions? no
  • Does this needs documentation? no

@prabhjyotsingh
Copy link
Contributor

I tried the default example it works awesomely well.

I might not have understood what all this PR is supposed to cover;

  1. I tried pyspark, which does not stream.
%pyspark
import time
print("1")
time.sleep(1)
print("2")
time.sleep(1)
print("3")
time.sleep(1)
print("4")
  1. also when I run following
import org.apache.commons.io.IOUtils
import java.net.URL
import java.nio.charset.Charset
(1 to 2).foreach{ i=>
    Thread.sleep(1000)
    println("Hello " + i)
}

before this PR the output was

import org.apache.commons.io.IOUtils
import java.net.URL
import java.nio.charset.Charset
Hello 1
Hello 2

but now its just

Hello 1
Hello 2

@corneadoug
Copy link
Contributor

I don't have any output for sc.version for example

@Leemoonsoo
Copy link
Member Author

@prabhjyotsingh @corneadoug Thanks for the feedback. Let me push more commits for the output issue as well as pyspark.

@swkimme
Copy link
Contributor

swkimme commented Jan 8, 2016

This is something what I REALLY needed. AWESOME!!

@corneadoug
Copy link
Contributor

Made a PR to refactor the JS code :)

@Leemoonsoo
Copy link
Member Author

@prabhjyotsingh @corneadoug Addressed the comments
stream_output

@prabhjyotsingh
Copy link
Contributor

@Leemoonsoo this is so awesome and useful feature. Thanks a lot of this.

@randerzander
Copy link
Contributor

I wonder if this can be used in combination with #152/Zeppelin-157 ? I'm thinking a streaming job emits GPS points which are dynamically populated on a map. @Madhuka @corneadoug

@Leemoonsoo
Copy link
Member Author

This PR stream output only when it's %text. It keeps the same behavior for %table, %html, %angular and all the other display system.

For dynamically populated data on a map, here's great example. https://gist.github.com/granturing/a09aed4a302a7367be92. Which leverage %angular display system

@corneadoug
Copy link
Contributor

Found another issue:
Clear paragraph output is not working for me anymore

@felixcheung
Copy link
Member

very cool. should SparkOutputStream be generalized - i think maybe other interpreters could stream output too (and maybe %table could use some partial result too?)

@Leemoonsoo
Copy link
Member Author

@corneadoug trying to fix clear paragraph output. no success for now
@felixcheung InterpreterOutput is generalized output stream and any other interpreter can use. Yes, handling %table and use partial result would be useful. It can be done as a future work i think.

@Leemoonsoo Leemoonsoo force-pushed the output_stream_frontend branch 2 times, most recently from b9c0d6e to debfc3e Compare January 13, 2016 01:07
@Leemoonsoo Leemoonsoo force-pushed the output_stream_frontend branch from 5b8c25a to d29cfbf Compare January 13, 2016 05:17
@Leemoonsoo
Copy link
Member Author

@corneadoug Fixed the clear paragraph output.

@minahlee
Copy link
Member

Tested and LGTM

@Leemoonsoo
Copy link
Member Author

Thanks @minahlee for the review. I'm merging it into master.

@asfgit asfgit closed this in 5ec59a8 Jan 20, 2016
asfgit pushed a commit that referenced this pull request Jan 21, 2016
### What is this PR for?
This PR provides HOTFIX for master branch build error introduced by #611

### What type of PR is it?
Hot Fix

### Todos
* [x] - Fix unittest

### Is there a relevant Jira issue?
N/A

### How should this be tested?
N/A

### Screenshots (if appropriate)
N/A

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Lee moon soo <[email protected]>

Closes #663 from Leemoonsoo/hotfix_ZEPPELIN-554 and squashes the following commits:

a468b2e [Lee moon soo] Update unit test
asfgit pushed a commit that referenced this pull request Feb 9, 2016
### 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)
![shell_interpreter](https://cloud.githubusercontent.com/assets/10060731/12745026/b12e7b28-c9da-11e5-8832-0ebc74bbf4f3.gif)

### 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants