Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
fadc6d9
userName to be present in InterpreterContext/RemoteInterpreterContext
prabhjyotsingh Feb 8, 2016
d928203
revert shiri.ini
prabhjyotsingh Feb 8, 2016
320790c
fix for CI, missing change signature
prabhjyotsingh Feb 9, 2016
57ca577
review change create such class AuthenticationInfo, and pass it into …
prabhjyotsingh Feb 16, 2016
ba91da4
Merge remote-tracking branch 'origin/master' into UserInInterpreterCo…
prabhjyotsingh Feb 16, 2016
34dcc32
instead of null pass "new AuthenticationInfo()"
prabhjyotsingh Feb 16, 2016
a5a991d
check for selenium
prabhjyotsingh Feb 16, 2016
95e7c13
test for selenium
prabhjyotsingh Feb 16, 2016
0709b9c
moving AuthenticationInfo to org.apache.zeppelin.display.Authenticati…
prabhjyotsingh Feb 16, 2016
4053497
test livy
prabhjyotsingh Feb 17, 2016
ace28a8
working livy
prabhjyotsingh Feb 17, 2016
d0519d5
Working livy interpreter with spark, pyspark, R
prabhjyotsingh Feb 19, 2016
10311d3
This works in all cases
prabhjyotsingh Feb 20, 2016
07f0846
with lspark sql
prabhjyotsingh Feb 20, 2016
8f4ec47
removing unrequired logs
prabhjyotsingh Feb 20, 2016
9cb0819
Fix for 1st request failing
prabhjyotsingh Feb 21, 2016
de2fd3c
have spark streaming
prabhjyotsingh Feb 22, 2016
b53fd8b
Don't need so many interpreters
rconline Feb 23, 2016
1f9a111
remove references to LivyInterpreters
rconline Feb 23, 2016
ee2dceb
working spark sql
prabhjyotsingh Feb 23, 2016
68f438d
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Feb 23, 2016
426bbe8
Merge branch 'livyInterperter' of https://github.com/prabhjyotsingh/i…
rconline Feb 23, 2016
4f513a5
site.xml
prabhjyotsingh Feb 24, 2016
948615a
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Feb 24, 2016
9d89b0d
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Feb 26, 2016
b8e1779
adding back LivySparkRInterpreter.java , pyspark
prabhjyotsingh Feb 26, 2016
dadc257
reverting zeppelinConfiguration
prabhjyotsingh Mar 2, 2016
0fbb74b
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 7, 2016
ea05fe9
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 8, 2016
ee1c9f4
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 9, 2016
78eca1e
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 11, 2016
5eb4eff
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 12, 2016
5bb5775
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 15, 2016
ca06e91
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 16, 2016
18468a0
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 18, 2016
32fbc1a
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 22, 2016
01ec474
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 23, 2016
6c6b164
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Mar 27, 2016
c58eae7
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 1, 2016
756558e
check for html tags and append "%html "
prabhjyotsingh Apr 1, 2016
dc0a3dc
fix append "%html "
prabhjyotsingh Apr 2, 2016
e43385e
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 2, 2016
557d1e1
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 4, 2016
a28d674
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 5, 2016
7cec9ba
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 6, 2016
3863682
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 7, 2016
40ce7cd
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 9, 2016
ff3c4ed
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 11, 2016
9a84e11
revert merge conflict
prabhjyotsingh Apr 11, 2016
1b79c07
more loging and exception handeling
prabhjyotsingh Apr 11, 2016
eb8706f
fix paragraph abort
prabhjyotsingh Apr 12, 2016
cb65c86
rename r to sparkr for consistent naming
prabhjyotsingh Apr 12, 2016
84bd755
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh Apr 20, 2016
9bfbe47
close livy session on connection close/restart interpreter
prabhjyotsingh Apr 20, 2016
bbe2a7c
rename lspark to livy
prabhjyotsingh Apr 20, 2016
f0e3c20
change variable name
prabhjyotsingh Apr 20, 2016
a3b0a06
add test for pyspark
prabhjyotsingh Apr 20, 2016
8c4b983
remove class name as it will be avail with the stack trace
prabhjyotsingh Apr 21, 2016
5f9be73
adding more mock test
prabhjyotsingh Apr 22, 2016
9be64e0
doc
prabhjyotsingh Apr 22, 2016
a6e7d0b
prefix zeppelin. to property zeppelin.livy.sql.maxResult
prabhjyotsingh Apr 28, 2016
7ff9744
update default value to 1000
prabhjyotsingh Apr 28, 2016
97d0663
add the doc to docs/_includes/themes/zeppelin/_navigation.html
prabhjyotsingh Apr 28, 2016
45e3d48
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh May 2, 2016
6c19e35
retry a for a minute and fail, instead of looping forever
prabhjyotsingh May 2, 2016
7f6fa24
check/incorporate recent changes of this code in the Spark interpreter
prabhjyotsingh May 3, 2016
ad26d0b
replace info with error
prabhjyotsingh May 3, 2016
c3e74f2
return error
prabhjyotsingh May 3, 2016
93708cd
setting the right condition
prabhjyotsingh May 3, 2016
8116b72
remove redundant getResultCode
prabhjyotsingh May 3, 2016
1e18465
LOGGER.error
prabhjyotsingh May 3, 2016
200e715
more exception handeling
prabhjyotsingh May 3, 2016
7a12336
missing exception handeling in LivySparkInterpreter
prabhjyotsingh May 3, 2016
134923d
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh May 10, 2016
23b7811
ZEPPELIN-773 livy to have conf for configuring yarn master
prabhjyotsingh May 11, 2016
fef1081
ZEPPELIN-773 add documentation for configuring Spark master uri.
prabhjyotsingh May 12, 2016
8095b3b
ZZEPPELIN-773: add doc for spark version
prabhjyotsingh May 14, 2016
53f2804
ZEPPELIN-773: add doc for livy impersonation
prabhjyotsingh May 14, 2016
f2ea724
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh May 16, 2016
44c5e82
ZEPPELIN-773: fail check if API allows master or conf in parameter
prabhjyotsingh May 17, 2016
6f1503f
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh May 17, 2016
3deca71
ZEPPELIN-773 update doc for know issue, and more error logging
prabhjyotsingh May 17, 2016
9833c59
ZEPPELIN-773: log error in all other status code
prabhjyotsingh May 18, 2016
5c2bf13
Merge remote-tracking branch 'origin/master' into livyInterperter
prabhjyotsingh May 19, 2016
aeb5a73
update doc with review comment and add FAQ
prabhjyotsingh May 19, 2016
9689da0
check for more session not found error
prabhjyotsingh May 19, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/zeppelin-site.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@

<property>
<name>zeppelin.interpreters</name>
<value>org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.rinterpreter.RRepl,org.apache.zeppelin.rinterpreter.KnitR,org.apache.zeppelin.spark.SparkRInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.hive.HiveInterpreter,org.apache.zeppelin.tajo.TajoInterpreter,org.apache.zeppelin.file.HDFSFileInterpreter,org.apache.zeppelin.flink.FlinkInterpreter,org.apache.zeppelin.lens.LensInterpreter,org.apache.zeppelin.ignite.IgniteInterpreter,org.apache.zeppelin.ignite.IgniteSqlInterpreter,org.apache.zeppelin.cassandra.CassandraInterpreter,org.apache.zeppelin.geode.GeodeOqlInterpreter,org.apache.zeppelin.postgresql.PostgreSqlInterpreter,org.apache.zeppelin.jdbc.JDBCInterpreter,org.apache.zeppelin.phoenix.PhoenixInterpreter,org.apache.zeppelin.kylin.KylinInterpreter,org.apache.zeppelin.elasticsearch.ElasticsearchInterpreter,org.apache.zeppelin.scalding.ScaldingInterpreter,org.apache.zeppelin.alluxio.AlluxioInterpreter,org.apache.zeppelin.hbase.HbaseInterpreter</value>
<value>org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.rinterpreter.RRepl,org.apache.zeppelin.rinterpreter.KnitR,org.apache.zeppelin.spark.SparkRInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.hive.HiveInterpreter,org.apache.zeppelin.tajo.TajoInterpreter,org.apache.zeppelin.file.HDFSFileInterpreter,org.apache.zeppelin.flink.FlinkInterpreter,org.apache.zeppelin.lens.LensInterpreter,org.apache.zeppelin.ignite.IgniteInterpreter,org.apache.zeppelin.ignite.IgniteSqlInterpreter,org.apache.zeppelin.cassandra.CassandraInterpreter,org.apache.zeppelin.geode.GeodeOqlInterpreter,org.apache.zeppelin.postgresql.PostgreSqlInterpreter,org.apache.zeppelin.jdbc.JDBCInterpreter,org.apache.zeppelin.phoenix.PhoenixInterpreter,org.apache.zeppelin.kylin.KylinInterpreter,org.apache.zeppelin.elasticsearch.ElasticsearchInterpreter,org.apache.zeppelin.scalding.ScaldingInterpreter,org.apache.zeppelin.alluxio.AlluxioInterpreter,org.apache.zeppelin.hbase.HbaseInterpreter,org.apache.zeppelin.livy.LivySparkInterpreter,org.apache.zeppelin.livy.LivyPySparkInterpreter,org.apache.zeppelin.livy.LivySparkRInterpreter,org.apache.zeppelin.livy.LivySparkSQLInterpreter</value>
<description>Comma separated interpreter configurations. First interpreter become a default</description>
</property>

Expand Down
1 change: 1 addition & 0 deletions docs/_includes/themes/zeppelin/_navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<li><a href="{{BASE_PATH}}/interpreter/ignite.html">Ignite</a></li>
<li><a href="{{BASE_PATH}}/interpreter/jdbc.html">JDBC</a></li>
<li><a href="{{BASE_PATH}}/interpreter/lens.html">Lens</a></li>
<li><a href="{{BASE_PATH}}/interpreter/livy.html">Livy</a></li>
<li><a href="{{BASE_PATH}}/interpreter/markdown.html">Markdown</a></li>
<li><a href="{{BASE_PATH}}/interpreter/postgresql.html">Postgresql, hawq</a></li>
<li><a href="{{BASE_PATH}}/interpreter/R.html">R</a></li>
Expand Down
107 changes: 107 additions & 0 deletions docs/interpreter/livy.md
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)
Copy link
Member

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?)

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?

Copy link
Member

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...

Copy link
Contributor Author

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

* 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**
Copy link
Contributor

@AhyoungRyu AhyoungRyu May 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this part is shown like below :
screen shot 2016-05-19 at 3 18 17 pm

If you intended this :
screen shot 2016-05-19 at 3 18 32 pm

You need to add a newline in here :)


```
%livy.spark
sc.version
```


**pyspark**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


```
%livy.pyspark
print "1"
Copy link
Member

@felixcheung felixcheung Apr 26, 2016

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

%livy.spark
val myObject = ...
z.put("objName", myObject)
Get object from python

%livy.pyspark
myObject = z.get("objName")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be cool!

```

**sparkR**
Copy link
Contributor

Choose a reason for hiding this comment

The 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.
170 changes: 170 additions & 0 deletions livy/pom.xml
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>
Loading