-
Notifications
You must be signed in to change notification settings - Fork 2.8k
ZEPPELIN-773 : Livy interperter #827
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
Changes from all commits
fadc6d9
d928203
320790c
57ca577
ba91da4
34dcc32
a5a991d
95e7c13
0709b9c
4053497
ace28a8
d0519d5
10311d3
07f0846
8f4ec47
9cb0819
de2fd3c
b53fd8b
1f9a111
ee2dceb
68f438d
426bbe8
4f513a5
948615a
9d89b0d
b8e1779
dadc257
0fbb74b
ea05fe9
ee1c9f4
78eca1e
5eb4eff
5bb5775
ca06e91
18468a0
32fbc1a
01ec474
6c6b164
c58eae7
756558e
dc0a3dc
e43385e
557d1e1
a28d674
7cec9ba
3863682
40ce7cd
ff3c4ed
9a84e11
1b79c07
eb8706f
cb65c86
84bd755
9bfbe47
bbe2a7c
f0e3c20
a3b0a06
8c4b983
5f9be73
9be64e0
a6e7d0b
7ff9744
97d0663
45e3d48
6c19e35
7f6fa24
ad26d0b
c3e74f2
93708cd
8116b72
1e18465
200e715
7a12336
134923d
23b7811
fef1081
8095b3b
53f2804
f2ea724
44c5e82
6f1503f
3deca71
9833c59
5c2bf13
aeb5a73
9689da0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| --- | ||
| layout: page | ||
| title: "Livy Interpreter" | ||
| description: "" | ||
| group: manual | ||
| --- | ||
| {% include JB/setup %} | ||
|
|
||
| ## Livy Interpreter for Apache Zeppelin | ||
| Livy is an open source REST interface for interacting with Spark from anywhere. It supports executing snippets of code or programs in a Spark context that runs locally or in YARN. | ||
|
|
||
| * Interactive Scala, Python and R shells | ||
| * Batch submissions in Scala, Java, Python | ||
| * Multi users can share the same server (impersonation support) | ||
| * Can be used for submitting jobs from anywhere with REST | ||
| * Does not require any code change to your programs | ||
|
|
||
| ### Requirements | ||
|
|
||
| Additional requirements for the Livy interpreter are: | ||
|
|
||
| * Spark 1.3 or above. | ||
| * Livy server. | ||
|
|
||
| ### Configuration | ||
| <table class="table-configuration"> | ||
| <tr> | ||
| <th>Property</th> | ||
| <th>Default</th> | ||
| <th>Description</th> | ||
| </tr> | ||
| <tr> | ||
| <td>zeppelin.livy.master</td> | ||
| <td>local[*]</td> | ||
| <td>Spark master uri. ex) spark://masterhost:7077</td> | ||
| </tr> | ||
| <tr> | ||
| <td>zeppelin.livy.url</td> | ||
| <td>http://localhost:8998</td> | ||
| <td>URL where livy server is running</td> | ||
| </tr> | ||
| <tr> | ||
| <td>zeppelin.livy.spark.maxResult</td> | ||
| <td>1000</td> | ||
| <td>Max number of SparkSQL result to display.</td> | ||
| </tr> | ||
| </table> | ||
|
|
||
|
|
||
|
|
||
| ## How to use | ||
| Basically, you can use | ||
|
|
||
| **spark** | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ``` | ||
| %livy.spark | ||
| sc.version | ||
| ``` | ||
|
|
||
|
|
||
| **pyspark** | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
|
|
||
| ``` | ||
| %livy.pyspark | ||
| print "1" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think different language session share the same SparkContext in Livy? Is there an example we could show how an user could work in Scala, then use the result from Python and so on?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it cannot be done. But I can do following in a different PR
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will be cool! |
||
| ``` | ||
|
|
||
| **sparkR** | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also same here. |
||
|
|
||
| ``` | ||
| %livy.sparkr | ||
| hello <- function( name ) { | ||
| sprintf( "Hello, %s", name ); | ||
| } | ||
|
|
||
| hello("livy") | ||
| ``` | ||
|
|
||
| ## Impersonation | ||
| When Zeppelin server is running with authentication enabled, then this interpreter utilizes Livy’s user impersonation feature i.e. sends extra parameter for creating and running a session ("proxyUser": "${loggedInUser}"). This is particularly useful when multi users are sharing a Notebook server. | ||
|
|
||
|
|
||
| ### Apply Zeppelin Dynamic Forms | ||
| You can leverage [Zeppelin Dynamic Form]({{BASE_PATH}}/manual/dynamicform.html). You can use both the `text input` and `select form` parameterization features. | ||
|
|
||
| ``` | ||
| %livy.pyspark | ||
| print "${group_by=product_id,product_id|product_name|customer_id|store_id}" | ||
| ``` | ||
|
|
||
| ## FAQ | ||
|
|
||
| Livy debugging: If you see any of these in error console | ||
|
|
||
| > Connect to livyhost:8998 [livyhost/127.0.0.1, livyhost/0:0:0:0:0:0:0:1] failed: Connection refused | ||
|
|
||
| Looks like the livy server is not up yet or the config is wrong | ||
|
|
||
| > Exception: Session not found, Livy server would have restarted, or lost session. | ||
|
|
||
| The session would have timed out, you may need to restart the interpreter. | ||
|
|
||
|
|
||
| > Blacklisted configuration values in session config: spark.master | ||
|
|
||
| edit `conf/spark-blacklist.conf` file in livy server and comment out `#spark.master` line. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| ~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
| ~ contributor license agreements. See the NOTICE file distributed with | ||
| ~ this work for additional information regarding copyright ownership. | ||
| ~ The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| ~ (the "License"); you may not use this file except in compliance with | ||
| ~ the License. You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, software | ||
| ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| ~ See the License for the specific language governing permissions and | ||
| ~ limitations under the License. | ||
| --> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <artifactId>zeppelin</artifactId> | ||
| <groupId>org.apache.zeppelin</groupId> | ||
| <version>0.6.0-incubating-SNAPSHOT</version> | ||
| <relativePath>..</relativePath> | ||
| </parent> | ||
|
|
||
| <groupId>org.apache.zeppelin</groupId> | ||
| <artifactId>zeppelin-livy</artifactId> | ||
| <packaging>jar</packaging> | ||
| <version>0.6.0-incubating-SNAPSHOT</version> | ||
| <name>Zeppelin: Livy interpreter</name> | ||
| <url>http://zeppelin.incubator.apache.org</url> | ||
|
|
||
| <properties> | ||
| <!--TEST--> | ||
| <junit.version>4.12</junit.version> | ||
| <achilles.version>3.2.4-Zeppelin</achilles.version> | ||
| <assertj.version>1.7.0</assertj.version> | ||
| <mockito.version>1.9.5</mockito.version> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>zeppelin-interpreter</artifactId> | ||
| <version>${project.version}</version> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.apache.commons</groupId> | ||
| <artifactId>commons-exec</artifactId> | ||
| <version>1.3</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-api</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-log4j12</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.apache.httpcomponents</groupId> | ||
| <artifactId>httpclient</artifactId> | ||
| <version>4.3.4</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.google.code.gson</groupId> | ||
| <artifactId>gson</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.assertj</groupId> | ||
| <artifactId>assertj-core</artifactId> | ||
| <version>${assertj.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.mockito</groupId> | ||
| <artifactId>mockito-all</artifactId> | ||
| <version>${mockito.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-deploy-plugin</artifactId> | ||
| <version>2.7</version> | ||
| <configuration> | ||
| <skip>true</skip> | ||
| </configuration> | ||
| </plugin> | ||
|
|
||
| <plugin> | ||
| <artifactId>maven-enforcer-plugin</artifactId> | ||
| <version>1.3.1</version> | ||
| <executions> | ||
| <execution> | ||
| <id>enforce</id> | ||
| <phase>none</phase> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
|
|
||
| <plugin> | ||
| <artifactId>maven-dependency-plugin</artifactId> | ||
| <version>2.8</version> | ||
| <executions> | ||
| <execution> | ||
| <id>copy-dependencies</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>copy-dependencies</goal> | ||
| </goals> | ||
| <configuration> | ||
| <outputDirectory>${project.build.directory}/../../interpreter/livy | ||
| </outputDirectory> | ||
| <overWriteReleases>false</overWriteReleases> | ||
| <overWriteSnapshots>false</overWriteSnapshots> | ||
| <overWriteIfNewer>true</overWriteIfNewer> | ||
| <includeScope>runtime</includeScope> | ||
| </configuration> | ||
| </execution> | ||
| <execution> | ||
| <id>copy-artifact</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>copy</goal> | ||
| </goals> | ||
| <configuration> | ||
| <outputDirectory>${project.build.directory}/../../interpreter/livy | ||
| </outputDirectory> | ||
| <overWriteReleases>false</overWriteReleases> | ||
| <overWriteSnapshots>false</overWriteSnapshots> | ||
| <overWriteIfNewer>true</overWriteIfNewer> | ||
| <includeScope>runtime</includeScope> | ||
| <artifactItems> | ||
| <artifactItem> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>${project.artifactId}</artifactId> | ||
| <version>${project.version}</version> | ||
| <type>${project.packaging}</type> | ||
| </artifactItem> | ||
| </artifactItems> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| </project> |


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.
how does impersonation work and how could one control this in Zeppelin?
(is this coming later?)
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.
My understanding is Livy will impersoante the user who execute the "run" from Notebook by calling spark-submit with --proxy-user option?
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.
Is this tied to Zeppelin Auth? If so we should explain that briefly here...
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.
Added a small note for the same 53f2804