mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Merge elasticsearch/pom.xml
This commit is contained in:
commit
4e9812e0f1
67 changed files with 912 additions and 290 deletions
|
|
@ -40,14 +40,14 @@ matrix:
|
|||
- jdk: "oraclejdk7"
|
||||
env: SCALA_VER="2.11" SPARK_VER="2.0.2" HADOOP_VER="2.6" PROFILE="-Prat" BUILD_FLAG="clean" TEST_FLAG="org.apache.rat:apache-rat-plugin:check" TEST_PROJECTS=""
|
||||
|
||||
# Test all modules with spark 2.1.0 and scala 2.11
|
||||
- jdk: "oraclejdk7"
|
||||
env: SCALA_VER="2.11" SPARK_VER="2.1.0" HADOOP_VER="2.6" PROFILE="-Pspark-2.1 -Phadoop-2.6 -Ppyspark -Psparkr -Pscalding -Phelium-dev -Pexamples -Pscala-2.11" BUILD_FLAG="package -Pbuild-distr -DskipRat" TEST_FLAG="verify -Pusing-packaged-distr -DskipRat" TEST_PROJECTS=""
|
||||
|
||||
# Test all modules with spark 2.0.2 and scala 2.11
|
||||
- jdk: "oraclejdk7"
|
||||
env: SCALA_VER="2.11" SPARK_VER="2.0.2" HADOOP_VER="2.6" PROFILE="-Pspark-2.0 -Phadoop-2.6 -Ppyspark -Psparkr -Pscalding -Phelium-dev -Pexamples -Pscala-2.11" BUILD_FLAG="package -Pbuild-distr -DskipRat" TEST_FLAG="verify -Pusing-packaged-distr -DskipRat" TEST_PROJECTS=""
|
||||
|
||||
# Test all modules with spark 2.1.0 and scala 2.11
|
||||
- jdk: "oraclejdk7"
|
||||
env: SCALA_VER="2.11" SPARK_VER="2.1.0" HADOOP_VER="2.6" PROFILE="-Pspark-2.0 -Phadoop-2.6 -Ppyspark -Psparkr -Pscalding -Phelium-dev -Pexamples -Pscala-2.11" BUILD_FLAG="package -Pbuild-distr -DskipRat" TEST_FLAG="verify -Pusing-packaged-distr -DskipRat" TEST_PROJECTS=""
|
||||
|
||||
# Test all modules with scala 2.10
|
||||
- jdk: "oraclejdk7"
|
||||
env: SCALA_VER="2.10" SPARK_VER="1.6.3" HADOOP_VER="2.6" PROFILE="-Pspark-1.6 -Pr -Phadoop-2.6 -Ppyspark -Psparkr -Pscalding -Pbeam -Phelium-dev -Pexamples -Pscala-2.10" BUILD_FLAG="package -Pbuild-distr -DskipRat" TEST_FLAG="verify -Pusing-packaged-distr -DskipRat" TEST_PROJECTS=""
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-alluxio</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Alluxio interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-angular</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Angular interpreter</name>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-beam</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Beam interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-bigquery</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: BigQuery interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-cassandra_2.10</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Apache Cassandra interpreter</name>
|
||||
<description>Zeppelin cassandra support</description>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,23 +17,23 @@
|
|||
#
|
||||
# [name] [maven artifact] [description]
|
||||
|
||||
alluxio org.apache.zeppelin:zeppelin-alluxio:0.6.1 Alluxio interpreter
|
||||
angular org.apache.zeppelin:zeppelin-angular:0.6.1 HTML and AngularJS view rendering
|
||||
beam org.apache.zeppelin:zeppelin-beam:0.6.1 Beam interpreter
|
||||
bigquery org.apache.zeppelin:zeppelin-bigquery:0.6.1 BigQuery interpreter
|
||||
cassandra org.apache.zeppelin:zeppelin-cassandra_2.11:0.6.1 Cassandra interpreter built with Scala 2.11
|
||||
elasticsearch org.apache.zeppelin:zeppelin-elasticsearch:0.6.1 Elasticsearch interpreter
|
||||
file org.apache.zeppelin:zeppelin-file:0.6.1 HDFS file interpreter
|
||||
flink org.apache.zeppelin:zeppelin-flink_2.11:0.6.1 Flink interpreter built with Scala 2.11
|
||||
hbase org.apache.zeppelin:zeppelin-hbase:0.6.1 Hbase interpreter
|
||||
ignite org.apache.zeppelin:zeppelin-ignite_2.11:0.6.1 Ignite interpreter built with Scala 2.11
|
||||
jdbc org.apache.zeppelin:zeppelin-jdbc:0.6.1 Jdbc interpreter
|
||||
kylin org.apache.zeppelin:zeppelin-kylin:0.6.1 Kylin interpreter
|
||||
lens org.apache.zeppelin:zeppelin-lens:0.6.1 Lens interpreter
|
||||
livy org.apache.zeppelin:zeppelin-livy:0.6.1 Livy interpreter
|
||||
md org.apache.zeppelin:zeppelin-markdown:0.6.1 Markdown support
|
||||
pig org.apache.zeppelin:zeppelin-pig:0.6.1 Pig interpreter
|
||||
postgresql org.apache.zeppelin:zeppelin-postgresql:0.6.1 Postgresql interpreter
|
||||
python org.apache.zeppelin:zeppelin-python:0.6.1 Python interpreter
|
||||
scio org.apache.zeppelin:zeppelin-scio:0.6.1 Scio interpreter
|
||||
shell org.apache.zeppelin:zeppelin-shell:0.6.1 Shell command
|
||||
alluxio org.apache.zeppelin:zeppelin-alluxio:0.7.0 Alluxio interpreter
|
||||
angular org.apache.zeppelin:zeppelin-angular:0.7.0 HTML and AngularJS view rendering
|
||||
beam org.apache.zeppelin:zeppelin-beam:0.7.0 Beam interpreter
|
||||
bigquery org.apache.zeppelin:zeppelin-bigquery:0.7.0 BigQuery interpreter
|
||||
cassandra org.apache.zeppelin:zeppelin-cassandra_2.11:0.7.0 Cassandra interpreter built with Scala 2.11
|
||||
elasticsearch org.apache.zeppelin:zeppelin-elasticsearch:0.7.0 Elasticsearch interpreter
|
||||
file org.apache.zeppelin:zeppelin-file:0.7.0 HDFS file interpreter
|
||||
flink org.apache.zeppelin:zeppelin-flink_2.11:0.7.0 Flink interpreter built with Scala 2.11
|
||||
hbase org.apache.zeppelin:zeppelin-hbase:0.7.0 Hbase interpreter
|
||||
ignite org.apache.zeppelin:zeppelin-ignite_2.11:0.7.0 Ignite interpreter built with Scala 2.11
|
||||
jdbc org.apache.zeppelin:zeppelin-jdbc:0.7.0 Jdbc interpreter
|
||||
kylin org.apache.zeppelin:zeppelin-kylin:0.7.0 Kylin interpreter
|
||||
lens org.apache.zeppelin:zeppelin-lens:0.7.0 Lens interpreter
|
||||
livy org.apache.zeppelin:zeppelin-livy:0.7.0 Livy interpreter
|
||||
md org.apache.zeppelin:zeppelin-markdown:0.7.0 Markdown support
|
||||
pig org.apache.zeppelin:zeppelin-pig:0.7.0 Pig interpreter
|
||||
postgresql org.apache.zeppelin:zeppelin-postgresql:0.7.0 Postgresql interpreter
|
||||
python org.apache.zeppelin:zeppelin-python:0.7.0 Python interpreter
|
||||
scio org.apache.zeppelin:zeppelin-scio_2.11:0.7.0 Scio interpreter
|
||||
shell org.apache.zeppelin:zeppelin-shell:0.7.0 Shell command
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ function make_binary_release() {
|
|||
build_docker_base
|
||||
git_clone
|
||||
make_source_package
|
||||
make_binary_release all "-Pspark-2.0 -Phadoop-2.6 -Pyarn -Ppyspark -Psparkr -Pscala-${SCALA_VERSION}"
|
||||
make_binary_release netinst "-Pspark-2.0 -Phadoop-2.6 -Pyarn -Ppyspark -Psparkr -Pscala-${SCALA_VERSION} -pl zeppelin-interpreter,zeppelin-zengine,:zeppelin-display_${SCALA_VERSION},:zeppelin-spark-dependencies_${SCALA_VERSION},:zeppelin-spark_${SCALA_VERSION},zeppelin-web,zeppelin-server,zeppelin-distribution -am"
|
||||
make_binary_release all "-Pspark-2.1 -Phadoop-2.6 -Pyarn -Ppyspark -Psparkr -Pscala-${SCALA_VERSION}"
|
||||
make_binary_release netinst "-Pspark-2.1 -Phadoop-2.6 -Pyarn -Ppyspark -Psparkr -Pscala-${SCALA_VERSION} -pl zeppelin-interpreter,zeppelin-zengine,:zeppelin-display_${SCALA_VERSION},:zeppelin-spark-dependencies_${SCALA_VERSION},:zeppelin-spark_${SCALA_VERSION},zeppelin-web,zeppelin-server,zeppelin-distribution -am"
|
||||
|
||||
# remove non release files and dirs
|
||||
rm -rf "${WORKING_DIR}/zeppelin"
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ NC='\033[0m' # No Color
|
|||
RELEASE_VERSION="$1"
|
||||
GIT_TAG="$2"
|
||||
|
||||
PUBLISH_PROFILES="-Ppublish-distr -Pspark-2.0 -Phadoop-2.6 -Pyarn -Ppyspark -Psparkr -Pr"
|
||||
PUBLISH_PROFILES="-Ppublish-distr -Pspark-2.1 -Phadoop-2.6 -Pyarn -Ppyspark -Psparkr -Pr"
|
||||
PROJECT_OPTIONS="-pl !zeppelin-distribution"
|
||||
NEXUS_STAGING="https://repository.apache.org/service/local/staging"
|
||||
NEXUS_PROFILE="153446d1ac37c4"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ author :
|
|||
twitter : ASF
|
||||
feedburner : feedname
|
||||
|
||||
ZEPPELIN_VERSION : 0.7.0-SNAPSHOT
|
||||
ZEPPELIN_VERSION : 0.8.0-SNAPSHOT
|
||||
|
||||
# The production_url is only used when full-domain names are needed
|
||||
# such as sitemap.txt
|
||||
|
|
@ -59,7 +59,7 @@ JB :
|
|||
# - Only the following values are falsy: ["", null, false]
|
||||
# - When setting BASE_PATH it must be a valid url.
|
||||
# This means always setting the protocol (http|https) or prefixing with "/"
|
||||
BASE_PATH : /docs/0.7.0-SNAPSHOT
|
||||
BASE_PATH : /docs/0.8.0-SNAPSHOT
|
||||
|
||||
# By default, the asset_path is automatically defined relative to BASE_PATH plus the enabled theme.
|
||||
# ex: [BASE_PATH]/assets/themes/[THEME-NAME]
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ Click 'enable' button.
|
|||
|
||||
#### 3. Create and load visualization bundle on the fly
|
||||
|
||||
Once a Visualization package is enabled, [HeliumVisualizationFactory](https://github.com/apache/zeppelin/blob/master/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumVisualizationPackage.java) creates a js bundle. The js bundle is served by `helium/visualization/load` rest api endpoint.
|
||||
Once a Visualization package is enabled, [HeliumVisualizationFactory](https://github.com/apache/zeppelin/blob/master/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumVisualizationFactory.java) creates a js bundle. The js bundle is served by `helium/visualization/load` rest api endpoint.
|
||||
|
||||
|
||||
#### 4. Run visualization
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ Set spark major version
|
|||
Available profiles are
|
||||
|
||||
```
|
||||
-Pspark-2.1
|
||||
-Pspark-2.0
|
||||
-Pspark-1.6
|
||||
-Pspark-1.5
|
||||
|
|
@ -185,6 +186,10 @@ Bulid examples under zeppelin-examples directory
|
|||
Here are some examples with several options:
|
||||
|
||||
```bash
|
||||
# build with spark-2.1, scala-2.11
|
||||
./dev/change_scala_version.sh 2.11
|
||||
mvn clean package -Pspark-2.1 -Phadoop-2.4 -Pyarn -Ppyspark -Psparkr -Pscala-2.11 -DskipTests
|
||||
|
||||
# build with spark-2.0, scala-2.11
|
||||
./dev/change_scala_version.sh 2.11
|
||||
mvn clean package -Pspark-2.0 -Phadoop-2.4 -Pyarn -Ppyspark -Psparkr -Pscala-2.11 -DskipTests
|
||||
|
|
|
|||
|
|
@ -159,6 +159,14 @@ There are more JDBC interpreter properties you can specify like below.
|
|||
<td>zeppelin.jdbc.keytab.location</td>
|
||||
<td>The path to the keytab file</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>default.jceks.file</td>
|
||||
<td>jceks store path (e.g: jceks://file/tmp/zeppelin.jceks)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>default.jceks.credentialKey</td>
|
||||
<td>jceks credential key</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
You can also add more properties by using this [method](http://docs.oracle.com/javase/7/docs/api/java/sql/DriverManager.html#getConnection%28java.lang.String,%20java.util.Properties%29).
|
||||
|
|
|
|||
|
|
@ -60,11 +60,21 @@ Example: `spark.driver.memory` to `livy.spark.driver.memory`
|
|||
<td>1000</td>
|
||||
<td>Max number of Spark SQL result to display.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>zeppelin.livy.session.create_timeout</td>
|
||||
<td>120</td>
|
||||
<td>Timeout in seconds for session creation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>zeppelin.livy.displayAppInfo</td>
|
||||
<td>false</td>
|
||||
<td>Whether to display app info</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>zeppelin.livy.pull_status.interval.millis</td>
|
||||
<td>1000</td>
|
||||
<td>The interval for checking paragraph execution status</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>livy.spark.driver.cores</td>
|
||||
<td></td>
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ limitations under the License.
|
|||
|
||||
<div id="toc"></div>
|
||||
|
||||
Apache Zeppelin provides **Interpreter Installation** mechanism for whom downloaded Zeppelin `netinst` binary package, or just want to install another 3rd party interpreters.
|
||||
Apache Zeppelin provides **Interpreter Installation** mechanism for whom downloaded Zeppelin `netinst` binary package, or just want to install another 3rd party interpreters.
|
||||
|
||||
## Community managed interpreters
|
||||
Apache Zeppelin provides several interpreters as [community managed interpreters](#available-community-managed-interpreters).
|
||||
Apache Zeppelin provides several interpreters as [community managed interpreters](#available-community-managed-interpreters).
|
||||
If you downloaded `netinst` binary package, you need to install by using below commands.
|
||||
|
||||
#### Install all community managed interpreters
|
||||
|
|
@ -48,7 +48,7 @@ You can get full list of community managed interpreters by running
|
|||
```
|
||||
|
||||
#### Install interpreter built with Scala 2.10
|
||||
From version 0.6.1, Zeppelin support both Scala 2.10 and 2.11 for several interpreters as below:
|
||||
Zeppelin support both Scala 2.10 and 2.11 for several interpreters as below:
|
||||
|
||||
<table class="table-configuration">
|
||||
<tr>
|
||||
|
|
@ -58,30 +58,35 @@ From version 0.6.1, Zeppelin support both Scala 2.10 and 2.11 for several interp
|
|||
</tr>
|
||||
<tr>
|
||||
<td>cassandra</td>
|
||||
<td>org.apache.zeppelin:zeppelin-cassandra_2.10:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-cassandra_2.11:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-cassandra_2.10:0.7.0</td>
|
||||
<td>org.apache.zeppelin:zeppelin-cassandra_2.11:0.7.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>flink</td>
|
||||
<td>org.apache.zeppelin:zeppelin-flink_2.10:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-flink_2.11:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-flink_2.10:0.7.0</td>
|
||||
<td>org.apache.zeppelin:zeppelin-flink_2.11:0.7.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ignite</td>
|
||||
<td>org.apache.zeppelin:zeppelin-ignite_2.10:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-ignite_2.11:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-ignite_2.10:0.7.0</td>
|
||||
<td>org.apache.zeppelin:zeppelin-ignite_2.11:0.7.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>flink</td>
|
||||
<td>org.apache.zeppelin:zeppelin-spark_2.10:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-spark_2.11:0.6.1</td>
|
||||
<td>scio</td>
|
||||
<td>org.apache.zeppelin:zeppelin-scio_2.10:0.7.0</td>
|
||||
<td>org.apache.zeppelin:zeppelin-scio_2.11:0.7.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>spark</td>
|
||||
<td>org.apache.zeppelin:zeppelin-spark_2.10:0.7.0</td>
|
||||
<td>org.apache.zeppelin:zeppelin-spark_2.11:0.7.0</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
If you install one of these interpreters only with `--name` option, installer will download interpreter built with Scala 2.11 by default. If you want to specify Scala version, you will need to add `--artifact` option. Here is the example of installing flink interpreter built with Scala 2.10.
|
||||
|
||||
```
|
||||
./bin/install-interpreter.sh --name flink --artifact org.apache.zeppelin:zeppelin-flink_2.10:0.6.1
|
||||
./bin/install-interpreter.sh --name flink --artifact org.apache.zeppelin:zeppelin-flink_2.10:0.7.0
|
||||
```
|
||||
|
||||
#### Install Spark interpreter built with Scala 2.10
|
||||
|
|
@ -89,7 +94,7 @@ Spark distribution package has been built with Scala 2.10 until 1.6.2. If you ha
|
|||
|
||||
```
|
||||
rm -rf ./interpreter/spark
|
||||
./bin/install-interpreter.sh --name spark --artifact org.apache.zeppelin:zeppelin-spark_2.10:0.6.1
|
||||
./bin/install-interpreter.sh --name spark --artifact org.apache.zeppelin:zeppelin-spark_2.10:0.7.0
|
||||
```
|
||||
|
||||
<br />
|
||||
|
|
@ -131,87 +136,102 @@ You can also find the below community managed interpreter list in `conf/interpre
|
|||
</tr>
|
||||
<tr>
|
||||
<td>alluxio</td>
|
||||
<td>org.apache.zeppelin:zeppelin-alluxio:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-alluxio:0.7.0</td>
|
||||
<td>Alluxio interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>angular</td>
|
||||
<td>org.apache.zeppelin:zeppelin-angular:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-angular:0.7.0</td>
|
||||
<td>HTML and AngularJS view rendering</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>beam</td>
|
||||
<td>org.apache.zeppelin:zeppelin-beam:0.7.0</td>
|
||||
<td>Beam interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bigquery</td>
|
||||
<td>org.apache.zeppelin:zeppelin-bigquery:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-bigquery:0.7.0</td>
|
||||
<td>BigQuery interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cassandra</td>
|
||||
<td>org.apache.zeppelin:zeppelin-cassandra\_2.11:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-cassandra\_2.11:0.7.0</td>
|
||||
<td>Cassandra interpreter built with Scala 2.11</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>elasticsearch</td>
|
||||
<td>org.apache.zeppelin:zeppelin-elasticsearch:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-elasticsearch:0.7.0</td>
|
||||
<td>Elasticsearch interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>file</td>
|
||||
<td>org.apache.zeppelin:zeppelin-file:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-file:0.7.0</td>
|
||||
<td>HDFS file interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>flink</td>
|
||||
<td>org.apache.zeppelin:zeppelin-flink\_2.11:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-flink\_2.11:0.7.0</td>
|
||||
<td>Flink interpreter built with Scala 2.11</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>hbase</td>
|
||||
<td>org.apache.zeppelin:zeppelin-hbase:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-hbase:0.7.0</td>
|
||||
<td>Hbase interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ignite</td>
|
||||
<td>org.apache.zeppelin:zeppelin-ignite\_2.11:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-ignite\_2.11:0.7.0</td>
|
||||
<td>Ignite interpreter built with Scala 2.11</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>jdbc</td>
|
||||
<td>org.apache.zeppelin:zeppelin-jdbc:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-jdbc:0.7.0</td>
|
||||
<td>Jdbc interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>kylin</td>
|
||||
<td>org.apache.zeppelin:zeppelin-kylin:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-kylin:0.7.0</td>
|
||||
<td>Kylin interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>lens</td>
|
||||
<td>org.apache.zeppelin:zeppelin-lens:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-lens:0.7.0</td>
|
||||
<td>Lens interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>livy</td>
|
||||
<td>org.apache.zeppelin:zeppelin-livy:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-livy:0.7.0</td>
|
||||
<td>Livy interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>md</td>
|
||||
<td>org.apache.zeppelin:zeppelin-markdown:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-markdown:0.7.0</td>
|
||||
<td>Markdown support</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pig</td>
|
||||
<td>org.apache.zeppelin:zeppelin-pig:0.7.0</td>
|
||||
<td>Pig interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>postgresql</td>
|
||||
<td>org.apache.zeppelin:zeppelin-postgresql:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-postgresql:0.7.0</td>
|
||||
<td>Postgresql interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>python</td>
|
||||
<td>org.apache.zeppelin:zeppelin-python:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-python:0.7.0</td>
|
||||
<td>Python interpreter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>scio</td>
|
||||
<td>org.apache.zeppelin:zeppelin-scio\_2.11:0.7.0</td>
|
||||
<td>Scio interpreter built with Scala 2.11</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>shell</td>
|
||||
<td>org.apache.zeppelin:zeppelin-shell:0.6.1</td>
|
||||
<td>org.apache.zeppelin:zeppelin-shell:0.7.0</td>
|
||||
<td>Shell command</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ limitations under the License.
|
|||
Apache Zeppelin has a pluggable notebook storage mechanism controlled by `zeppelin.notebook.storage` configuration option with multiple implementations.
|
||||
There are few notebook storage systems available for a use out of the box:
|
||||
|
||||
* (default) all notes are saved in the notebook folder in your local File System - `VFSNotebookRepo`
|
||||
* use local file system and version it using local Git repository - `GitNotebookRepo`
|
||||
* (default) use local file system and version it using local Git repository - `GitNotebookRepo`
|
||||
* all notes are saved in the notebook folder in your local File System - `VFSNotebookRepo`
|
||||
* storage using Amazon S3 service - `S3NotebookRepo`
|
||||
* storage using Azure service - `AzureNotebookRepo`
|
||||
|
||||
|
|
@ -100,13 +100,13 @@ Uncomment the next property for use S3NotebookRepo class:
|
|||
</property>
|
||||
```
|
||||
|
||||
Comment out the next property to disable local notebook storage (the default):
|
||||
Comment out the next property to disable local git notebook storage (the default):
|
||||
|
||||
```
|
||||
<property>
|
||||
<name>zeppelin.notebook.storage</name>
|
||||
<value>org.apache.zeppelin.notebook.repo.VFSNotebookRepo</value>
|
||||
<description>notebook persistence layer implementation</description>
|
||||
<value>org.apache.zeppelin.notebook.repo.GitNotebookRepo</value>
|
||||
<description>versioned notebook persistence layer implementation</description>
|
||||
</property>
|
||||
```
|
||||
|
||||
|
|
@ -191,8 +191,8 @@ Secondly, you can initialize `AzureNotebookRepo` class in the file **zeppelin-si
|
|||
```
|
||||
<property>
|
||||
<name>zeppelin.notebook.storage</name>
|
||||
<value>org.apache.zeppelin.notebook.repo.VFSNotebookRepo</value>
|
||||
<description>notebook persistence layer implementation</description>
|
||||
<value>org.apache.zeppelin.notebook.repo.GitNotebookRepo</value>
|
||||
<description>versioned notebook persistence layer implementation</description>
|
||||
</property>
|
||||
```
|
||||
|
||||
|
|
@ -206,12 +206,12 @@ and commenting out:
|
|||
</property>
|
||||
```
|
||||
|
||||
In case you want to use simultaneously your local storage with Azure storage use the following property instead:
|
||||
In case you want to use simultaneously your local git storage with Azure storage use the following property instead:
|
||||
|
||||
```
|
||||
<property>
|
||||
<name>zeppelin.notebook.storage</name>
|
||||
<value>org.apache.zeppelin.notebook.repo.VFSNotebookRepo, apache.zeppelin.notebook.repo.AzureNotebookRepo</value>
|
||||
<value>org.apache.zeppelin.notebook.repo.GitNotebookRepo, apache.zeppelin.notebook.repo.AzureNotebookRepo</value>
|
||||
<description>notebook persistence layer implementation</description>
|
||||
</property>
|
||||
```
|
||||
|
|
@ -236,7 +236,7 @@ ZeppelinHub storage layer allows out of the box connection of Zeppelin instance
|
|||
<!--
|
||||
<property>
|
||||
<name>zeppelin.notebook.storage</name>
|
||||
<value>org.apache.zeppelin.notebook.repo.VFSNotebookRepo, org.apache.zeppelin.notebook.repo.zeppelinhub.ZeppelinHubRepo</value>
|
||||
<value>org.apache.zeppelin.notebook.repo.GitNotebookRepo, org.apache.zeppelin.notebook.repo.zeppelinhub.ZeppelinHubRepo</value>
|
||||
<description>two notebook persistence layers (local + ZeppelinHub)</description>
|
||||
</property>
|
||||
-->
|
||||
|
|
@ -245,7 +245,7 @@ ZeppelinHub storage layer allows out of the box connection of Zeppelin instance
|
|||
or set the environment variable in the file **zeppelin-env.sh**:
|
||||
|
||||
```
|
||||
export ZEPPELIN_NOTEBOOK_STORAGE="org.apache.zeppelin.notebook.repo.VFSNotebookRepo, org.apache.zeppelin.notebook.repo.zeppelinhub.ZeppelinHubRepo"
|
||||
export ZEPPELIN_NOTEBOOK_STORAGE="org.apache.zeppelin.notebook.repo.GitNotebookRepo, org.apache.zeppelin.notebook.repo.zeppelinhub.ZeppelinHubRepo"
|
||||
```
|
||||
|
||||
Secondly, you need to set the environment variables in the file **zeppelin-env.sh**:
|
||||
|
|
|
|||
|
|
@ -22,12 +22,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>zeppelin-elasticsearch</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Elasticsearch interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-file</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: File System Interpreters</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-flink_2.10</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Flink</name>
|
||||
<description>Zeppelin flink support</description>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-geode</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Apache Geode interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-hbase</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: HBase interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@
|
|||
<parent>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>helium-dev</artifactId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Helium development interpreter</name>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>zeppelin-ignite_2.10</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Apache Ignite interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
58
jdbc/pom.xml
58
jdbc/pom.xml
|
|
@ -23,13 +23,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-jdbc</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: JDBC interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
@ -39,6 +39,7 @@
|
|||
<hadoop.common.version>2.7.2</hadoop.common.version>
|
||||
<h2.version>1.4.190</h2.version>
|
||||
<commons.dbcp2.version>2.0.1</commons.dbcp2.version>
|
||||
<hadoop-common.version>2.6.0</hadoop-common.version>
|
||||
|
||||
<!--test library versions-->
|
||||
<mockrunner.jdbc.version>1.0.8</mockrunner.jdbc.version>
|
||||
|
|
@ -117,6 +118,59 @@
|
|||
<version>${mockrunner.jdbc.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-common</artifactId>
|
||||
<version>${hadoop-common.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-json</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-server</artifactId>
|
||||
</exclusion>
|
||||
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.avro</groupId>
|
||||
<artifactId>avro</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-webdav</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.zookeeper</groupId>
|
||||
<artifactId>zookeeper</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@
|
|||
package org.apache.zeppelin.jdbc;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.containsIgnoreCase;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.isEmpty;
|
||||
import static org.apache.commons.lang.StringUtils.isNotEmpty;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
|
|
@ -40,10 +40,12 @@ import org.apache.commons.dbcp2.ConnectionFactory;
|
|||
import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
|
||||
import org.apache.commons.dbcp2.PoolableConnectionFactory;
|
||||
import org.apache.commons.dbcp2.PoolingDriver;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.pool2.ObjectPool;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPool;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.security.alias.CredentialProvider;
|
||||
import org.apache.hadoop.security.alias.CredentialProviderFactory;
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
|
|
@ -87,8 +89,6 @@ public class JDBCInterpreter extends Interpreter {
|
|||
private Logger logger = LoggerFactory.getLogger(JDBCInterpreter.class);
|
||||
|
||||
static final String INTERPRETER_NAME = "jdbc";
|
||||
static final String JDBC_DEFAULT_USER_KEY = "default.user";
|
||||
static final String JDBC_DEFAULT_PASSWORD_KEY = "default.password";
|
||||
static final String COMMON_KEY = "common";
|
||||
static final String MAX_LINE_KEY = "max_count";
|
||||
static final int MAX_LINE_DEFAULT = 1000;
|
||||
|
|
@ -98,6 +98,8 @@ public class JDBCInterpreter extends Interpreter {
|
|||
static final String URL_KEY = "url";
|
||||
static final String USER_KEY = "user";
|
||||
static final String PASSWORD_KEY = "password";
|
||||
static final String JDBC_JCEKS_FILE = "jceks.file";
|
||||
static final String JDBC_JCEKS_CREDENTIAL_KEY = "jceks.credentialKey";
|
||||
static final String DOT = ".";
|
||||
|
||||
private static final char WHITESPACE = ' ';
|
||||
|
|
@ -105,7 +107,6 @@ public class JDBCInterpreter extends Interpreter {
|
|||
private static final char TAB = '\t';
|
||||
private static final String TABLE_MAGIC_TAG = "%table ";
|
||||
private static final String EXPLAIN_PREDICATE = "EXPLAIN ";
|
||||
private static final String UPDATE_COUNT_HEADER = "Update Count";
|
||||
|
||||
static final String COMMON_MAX_LINE = COMMON_KEY + DOT + MAX_LINE_KEY;
|
||||
|
||||
|
|
@ -182,7 +183,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
}
|
||||
logger.debug("JDBC PropretiesMap: {}", basePropretiesMap);
|
||||
|
||||
if (!StringUtils.isEmpty(property.getProperty("zeppelin.jdbc.auth.type"))) {
|
||||
if (!isEmpty(property.getProperty("zeppelin.jdbc.auth.type"))) {
|
||||
JDBCSecurityImpl.createSecureConfiguration(property);
|
||||
}
|
||||
for (String propertyKey : basePropretiesMap.keySet()) {
|
||||
|
|
@ -261,9 +262,9 @@ public class JDBCInterpreter extends Interpreter {
|
|||
return driverName.toString();
|
||||
}
|
||||
|
||||
private boolean existAccountInBaseProperty() {
|
||||
return property.containsKey(JDBC_DEFAULT_USER_KEY) &&
|
||||
property.containsKey(JDBC_DEFAULT_PASSWORD_KEY);
|
||||
private boolean existAccountInBaseProperty(String propertyKey) {
|
||||
return basePropretiesMap.get(propertyKey).containsKey(USER_KEY) &&
|
||||
basePropretiesMap.get(propertyKey).containsKey(PASSWORD_KEY);
|
||||
}
|
||||
|
||||
private UsernamePassword getUsernamePassword(InterpreterContext interpreterContext,
|
||||
|
|
@ -295,15 +296,22 @@ public class JDBCInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
private void setUserProperty(String propertyKey, InterpreterContext interpreterContext)
|
||||
throws SQLException {
|
||||
throws SQLException, IOException {
|
||||
|
||||
String user = interpreterContext.getAuthenticationInfo().getUser();
|
||||
|
||||
JDBCUserConfigurations jdbcUserConfigurations =
|
||||
getJDBCConfiguration(user);
|
||||
if (basePropretiesMap.get(propertyKey).containsKey(USER_KEY) &&
|
||||
!basePropretiesMap.get(propertyKey).getProperty(USER_KEY).isEmpty()) {
|
||||
String password = getPassword(basePropretiesMap.get(propertyKey));
|
||||
if (!isEmpty(password)) {
|
||||
basePropretiesMap.get(propertyKey).setProperty(PASSWORD_KEY, password);
|
||||
}
|
||||
}
|
||||
jdbcUserConfigurations.setPropertyMap(propertyKey, basePropretiesMap.get(propertyKey));
|
||||
|
||||
if (existAccountInBaseProperty()) {
|
||||
if (existAccountInBaseProperty(propertyKey)) {
|
||||
return;
|
||||
}
|
||||
jdbcUserConfigurations.cleanUserProperty(propertyKey);
|
||||
|
|
@ -344,7 +352,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
public Connection getConnection(String propertyKey, InterpreterContext interpreterContext)
|
||||
throws ClassNotFoundException, SQLException, InterpreterException {
|
||||
throws ClassNotFoundException, SQLException, InterpreterException, IOException {
|
||||
final String user = interpreterContext.getAuthenticationInfo().getUser();
|
||||
Connection connection;
|
||||
if (propertyKey == null || basePropretiesMap.get(propertyKey) == null) {
|
||||
|
|
@ -357,7 +365,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
final Properties properties = jdbcUserConfigurations.getPropertyMap(propertyKey);
|
||||
final String url = properties.getProperty(URL_KEY);
|
||||
|
||||
if (StringUtils.isEmpty(property.getProperty("zeppelin.jdbc.auth.type"))) {
|
||||
if (isEmpty(property.getProperty("zeppelin.jdbc.auth.type"))) {
|
||||
connection = getConnectionFromPool(url, user, propertyKey, properties);
|
||||
} else {
|
||||
UserGroupInformation.AuthenticationMethod authType = JDBCSecurityImpl.getAuthtype(property);
|
||||
|
|
@ -410,6 +418,34 @@ public class JDBCInterpreter extends Interpreter {
|
|||
return connection;
|
||||
}
|
||||
|
||||
private String getPassword(Properties properties) throws IOException {
|
||||
if (isNotEmpty(properties.getProperty(PASSWORD_KEY))) {
|
||||
return properties.getProperty(PASSWORD_KEY);
|
||||
} else if (isNotEmpty(properties.getProperty(JDBC_JCEKS_FILE))
|
||||
&& isNotEmpty(properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY))) {
|
||||
try {
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH,
|
||||
properties.getProperty(JDBC_JCEKS_FILE));
|
||||
CredentialProvider provider = CredentialProviderFactory.getProviders(configuration).get(0);
|
||||
CredentialProvider.CredentialEntry credEntry =
|
||||
provider.getCredentialEntry(properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY));
|
||||
if (credEntry != null) {
|
||||
return new String(credEntry.getCredential());
|
||||
} else {
|
||||
throw new InterpreterException("Failed to retrieve password from JCEKS from key: "
|
||||
+ properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to retrieve password from JCEKS \n" +
|
||||
"For file: " + properties.getProperty(JDBC_JCEKS_FILE) +
|
||||
"\nFor key: " + properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getResults(ResultSet resultSet, boolean isTableType)
|
||||
throws SQLException {
|
||||
ResultSetMetaData md = resultSet.getMetaData();
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-kylin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Kylin interpreter</name>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-lens</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Lens interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-livy</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Livy interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.apache.zeppelin.livy;
|
||||
|
||||
/**
|
||||
* APINotFoundException happens because we may introduce new apis in new livy version.
|
||||
*/
|
||||
public class APINotFoundException extends LivyException {
|
||||
public APINotFoundException() {
|
||||
}
|
||||
|
||||
public APINotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public APINotFoundException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public APINotFoundException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public APINotFoundException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Base class for livy interpreters.
|
||||
|
|
@ -48,15 +49,25 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
|
||||
protected volatile SessionInfo sessionInfo;
|
||||
private String livyURL;
|
||||
private long sessionCreationTimeout;
|
||||
private int sessionCreationTimeout;
|
||||
private int pullStatusInterval;
|
||||
protected boolean displayAppInfo;
|
||||
private AtomicBoolean sessionExpired = new AtomicBoolean(false);
|
||||
private LivyVersion livyVersion;
|
||||
|
||||
// keep tracking the mapping between paragraphId and statementId, so that we can cancel the
|
||||
// statement after we execute it.
|
||||
private ConcurrentHashMap<String, Integer> paragraphId2StmtIdMapping = new ConcurrentHashMap<>();
|
||||
|
||||
public BaseLivyInterprereter(Properties property) {
|
||||
super(property);
|
||||
this.livyURL = property.getProperty("zeppelin.livy.url");
|
||||
this.sessionCreationTimeout = Long.parseLong(
|
||||
property.getProperty("zeppelin.livy.create.session.timeout", 120 + ""));
|
||||
this.displayAppInfo = Boolean.parseBoolean(
|
||||
property.getProperty("zeppelin.livy.displayAppInfo", "false"));
|
||||
this.sessionCreationTimeout = Integer.parseInt(
|
||||
property.getProperty("zeppelin.livy.session.create_timeout", 120 + ""));
|
||||
this.pullStatusInterval = Integer.parseInt(
|
||||
property.getProperty("zeppelin.livy.pull_status.interval.millis", 1000 + ""));
|
||||
}
|
||||
|
||||
public abstract String getSessionKind();
|
||||
|
|
@ -68,7 +79,6 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
} catch (LivyException e) {
|
||||
String msg = "Fail to create session, please check livy interpreter log and " +
|
||||
"livy server log";
|
||||
LOGGER.error(msg);
|
||||
throw new RuntimeException(msg, e);
|
||||
}
|
||||
}
|
||||
|
|
@ -89,23 +99,34 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
// livy 0.2 don't return appId and sparkUiUrl in response so that we need to get it
|
||||
// explicitly by ourselves.
|
||||
sessionInfo.appId = extractStatementResult(
|
||||
interpret("sc.applicationId", false, false).message()
|
||||
interpret("sc.applicationId", null, false, false).message()
|
||||
.get(0).getData());
|
||||
}
|
||||
|
||||
interpret(
|
||||
"val webui=sc.getClass.getMethod(\"ui\").invoke(sc).asInstanceOf[Some[_]].get",
|
||||
false, false);
|
||||
if (StringUtils.isEmpty(sessionInfo.appInfo.get("sparkUiUrl"))) {
|
||||
if (sessionInfo.appInfo == null ||
|
||||
StringUtils.isEmpty(sessionInfo.appInfo.get("sparkUiUrl"))) {
|
||||
interpret(
|
||||
"val webui=sc.getClass.getMethod(\"ui\").invoke(sc).asInstanceOf[Some[_]].get",
|
||||
null, false, false);
|
||||
sessionInfo.webUIAddress = extractStatementResult(
|
||||
interpret(
|
||||
"webui.getClass.getMethod(\"appUIAddress\").invoke(webui)", false, false)
|
||||
"webui.getClass.getMethod(\"appUIAddress\").invoke(webui)", null, false, false)
|
||||
.message().get(0).getData());
|
||||
} else {
|
||||
sessionInfo.webUIAddress = sessionInfo.appInfo.get("sparkUiUrl");
|
||||
}
|
||||
LOGGER.info("Create livy session successfully with sessionId: {}, appId: {}, webUI: {}",
|
||||
sessionInfo.id, sessionInfo.appId, sessionInfo.webUIAddress);
|
||||
} else {
|
||||
LOGGER.info("Create livy session successfully with sessionId: {}", this.sessionInfo.id);
|
||||
}
|
||||
// check livy version
|
||||
try {
|
||||
this.livyVersion = getLivyVersion();
|
||||
LOGGER.info("Use livy " + livyVersion);
|
||||
} catch (APINotFoundException e) {
|
||||
this.livyVersion = new LivyVersion("0.2.0");
|
||||
LOGGER.info("Use livy 0.2.0");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +141,7 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
}
|
||||
|
||||
try {
|
||||
return interpret(st, this.displayAppInfo, true);
|
||||
return interpret(st, context.getParagraphId(), this.displayAppInfo, true);
|
||||
} catch (LivyException e) {
|
||||
LOGGER.error("Fail to interpret:" + st, e);
|
||||
return new InterpreterResult(InterpreterResult.Code.ERROR,
|
||||
|
|
@ -148,7 +169,21 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
|
||||
@Override
|
||||
public void cancel(InterpreterContext context) {
|
||||
//TODO(zjffdu). Use livy cancel api which is available in livy 0.3
|
||||
if (livyVersion.isCancelSupported()) {
|
||||
String paraId = context.getParagraphId();
|
||||
Integer stmtId = paragraphId2StmtIdMapping.get(paraId);
|
||||
try {
|
||||
if (stmtId != null) {
|
||||
cancelStatement(stmtId);
|
||||
}
|
||||
} catch (LivyException e) {
|
||||
LOGGER.error("Fail to cancel statement " + stmtId + " for paragraph " + paraId, e);
|
||||
} finally {
|
||||
paragraphId2StmtIdMapping.remove(paraId);
|
||||
}
|
||||
} else {
|
||||
LOGGER.warn("cancel is not supported for this version of livy: " + livyVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -182,17 +217,15 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
if (sessionInfo.isFinished()) {
|
||||
String msg = "Session " + sessionInfo.id + " is finished, appId: " + sessionInfo.appId
|
||||
+ ", log: " + sessionInfo.log;
|
||||
LOGGER.error(msg);
|
||||
throw new LivyException(msg);
|
||||
}
|
||||
if ((System.currentTimeMillis() - start) / 1000 > sessionCreationTimeout) {
|
||||
String msg = "The creation of session " + sessionInfo.id + " is timeout within "
|
||||
+ sessionCreationTimeout + " seconds, appId: " + sessionInfo.appId
|
||||
+ ", log: " + sessionInfo.log;
|
||||
LOGGER.error(msg);
|
||||
throw new LivyException(msg);
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(pullStatusInterval);
|
||||
sessionInfo = getSessionInfo(sessionInfo.id);
|
||||
}
|
||||
return sessionInfo;
|
||||
|
|
@ -206,44 +239,58 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
return SessionInfo.fromJson(callRestAPI("/sessions/" + sessionId, "GET"));
|
||||
}
|
||||
|
||||
public InterpreterResult interpret(String code, boolean displayAppInfo,
|
||||
boolean appendSessionExpired)
|
||||
throws LivyException {
|
||||
public InterpreterResult interpret(String code,
|
||||
String paragraphId,
|
||||
boolean displayAppInfo,
|
||||
boolean appendSessionExpired) throws LivyException {
|
||||
StatementInfo stmtInfo = null;
|
||||
boolean sessionExpired = false;
|
||||
try {
|
||||
stmtInfo = executeStatement(new ExecuteRequest(code));
|
||||
} catch (SessionNotFoundException e) {
|
||||
LOGGER.warn("Livy session {} is expired, new session will be created.", sessionInfo.id);
|
||||
sessionExpired = true;
|
||||
// we don't want to create multiple sessions because it is possible to have multiple thread
|
||||
// to call this method, like LivySparkSQLInterpreter which use ParallelScheduler. So we need
|
||||
// to check session status again in this sync block
|
||||
synchronized (this) {
|
||||
if (isSessionExpired()) {
|
||||
initLivySession();
|
||||
}
|
||||
}
|
||||
stmtInfo = executeStatement(new ExecuteRequest(code));
|
||||
}
|
||||
// pull the statement status
|
||||
while (!stmtInfo.isAvailable()) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error("InterruptedException when pulling statement status.", e);
|
||||
throw new LivyException(e);
|
||||
stmtInfo = executeStatement(new ExecuteRequest(code));
|
||||
} catch (SessionNotFoundException e) {
|
||||
LOGGER.warn("Livy session {} is expired, new session will be created.", sessionInfo.id);
|
||||
sessionExpired = true;
|
||||
// we don't want to create multiple sessions because it is possible to have multiple thread
|
||||
// to call this method, like LivySparkSQLInterpreter which use ParallelScheduler. So we need
|
||||
// to check session status again in this sync block
|
||||
synchronized (this) {
|
||||
if (isSessionExpired()) {
|
||||
initLivySession();
|
||||
}
|
||||
}
|
||||
stmtInfo = executeStatement(new ExecuteRequest(code));
|
||||
}
|
||||
if (paragraphId != null) {
|
||||
paragraphId2StmtIdMapping.put(paragraphId, stmtInfo.id);
|
||||
}
|
||||
// pull the statement status
|
||||
while (!stmtInfo.isAvailable()) {
|
||||
try {
|
||||
Thread.sleep(pullStatusInterval);
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error("InterruptedException when pulling statement status.", e);
|
||||
throw new LivyException(e);
|
||||
}
|
||||
stmtInfo = getStatementInfo(stmtInfo.id);
|
||||
}
|
||||
if (appendSessionExpired) {
|
||||
return appendSessionExpire(getResultFromStatementInfo(stmtInfo, displayAppInfo),
|
||||
sessionExpired);
|
||||
} else {
|
||||
return getResultFromStatementInfo(stmtInfo, displayAppInfo);
|
||||
}
|
||||
} finally {
|
||||
if (paragraphId != null) {
|
||||
paragraphId2StmtIdMapping.remove(paragraphId);
|
||||
}
|
||||
stmtInfo = getStatementInfo(stmtInfo.id);
|
||||
}
|
||||
if (appendSessionExpired) {
|
||||
return appendSessionExpire(getResultFromStatementInfo(stmtInfo, displayAppInfo),
|
||||
sessionExpired);
|
||||
} else {
|
||||
return getResultFromStatementInfo(stmtInfo, displayAppInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private LivyVersion getLivyVersion() throws LivyException {
|
||||
return new LivyVersion((LivyVersionResponse.fromJson(callRestAPI("/version", "GET")).version));
|
||||
}
|
||||
|
||||
private boolean isSessionExpired() throws LivyException {
|
||||
try {
|
||||
getSessionInfo(sessionInfo.id);
|
||||
|
|
@ -270,6 +317,7 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private InterpreterResult getResultFromStatementInfo(StatementInfo stmtInfo,
|
||||
boolean displayAppInfo) {
|
||||
if (stmtInfo.output.isError()) {
|
||||
|
|
@ -313,16 +361,14 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
|
||||
if (displayAppInfo) {
|
||||
//TODO(zjffdu), use multiple InterpreterResult to display appInfo
|
||||
StringBuilder outputBuilder = new StringBuilder();
|
||||
outputBuilder.append("%angular ");
|
||||
outputBuilder.append("<pre><code>");
|
||||
outputBuilder.append(result);
|
||||
outputBuilder.append("</code></pre>");
|
||||
outputBuilder.append("<hr/>");
|
||||
outputBuilder.append("Spark Application Id:" + sessionInfo.appId + "<br/>");
|
||||
outputBuilder.append("Spark WebUI: <a href=" + sessionInfo.webUIAddress + ">"
|
||||
+ sessionInfo.webUIAddress + "</a>");
|
||||
return new InterpreterResult(InterpreterResult.Code.SUCCESS, outputBuilder.toString());
|
||||
InterpreterResult interpreterResult = new InterpreterResult(InterpreterResult.Code.SUCCESS);
|
||||
interpreterResult.add(InterpreterResult.Type.TEXT, result);
|
||||
String appInfoHtml = "<hr/>Spark Application Id: " + sessionInfo.appId + "<br/>"
|
||||
+ "Spark WebUI: <a href=\"" + sessionInfo.webUIAddress + "\">"
|
||||
+ sessionInfo.webUIAddress + "</a>";
|
||||
LOGGER.info("appInfoHtml:" + appInfoHtml);
|
||||
interpreterResult.add(InterpreterResult.Type.HTML, appInfoHtml);
|
||||
return interpreterResult;
|
||||
} else {
|
||||
return new InterpreterResult(InterpreterResult.Code.SUCCESS, result);
|
||||
}
|
||||
|
|
@ -341,6 +387,10 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
callRestAPI("/sessions/" + sessionInfo.id + "/statements/" + statementId, "GET"));
|
||||
}
|
||||
|
||||
private void cancelStatement(int statementId) throws LivyException {
|
||||
callRestAPI("/sessions/" + sessionInfo.id + "/statements/" + statementId + "/cancel", "POST");
|
||||
}
|
||||
|
||||
private RestTemplate getRestTemplate() {
|
||||
String keytabLocation = property.getProperty("zeppelin.livy.keytab");
|
||||
String principal = property.getProperty("zeppelin.livy.principal");
|
||||
|
|
@ -385,21 +435,20 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
LOGGER.debug("Get response, StatusCode: {}, responseBody: {}", response.getStatusCode(),
|
||||
response.getBody());
|
||||
if (response.getStatusCode().value() == 200
|
||||
|| response.getStatusCode().value() == 201
|
||||
|| response.getStatusCode().value() == 404) {
|
||||
String responseBody = response.getBody();
|
||||
if (responseBody.matches("\"Session '\\d+' not found.\"")) {
|
||||
throw new SessionNotFoundException(responseBody);
|
||||
|| response.getStatusCode().value() == 201) {
|
||||
return response.getBody();
|
||||
} else if (response.getStatusCode().value() == 404) {
|
||||
if (response.getBody().matches("Session '\\d+' not found.")) {
|
||||
throw new SessionNotFoundException(response.getBody());
|
||||
} else {
|
||||
return responseBody;
|
||||
throw new APINotFoundException("No rest api found for " + targetURL +
|
||||
", " + response.getStatusCode());
|
||||
}
|
||||
} else {
|
||||
String responseString = response.getBody();
|
||||
if (responseString.contains("CreateInteractiveRequest[\\\"master\\\"]")) {
|
||||
return responseString;
|
||||
}
|
||||
LOGGER.error(String.format("Error with %s StatusCode: %s",
|
||||
response.getStatusCode().value(), responseString));
|
||||
throw new LivyException(String.format("Error with %s StatusCode: %s",
|
||||
response.getStatusCode().value(), responseString));
|
||||
}
|
||||
|
|
@ -502,7 +551,7 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
}
|
||||
|
||||
public boolean isAvailable() {
|
||||
return state.equals("available");
|
||||
return state.equals("available") || state.equals("cancelled");
|
||||
}
|
||||
|
||||
private static class StatementOutput {
|
||||
|
|
@ -543,4 +592,17 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
}
|
||||
}
|
||||
|
||||
private static class LivyVersionResponse {
|
||||
public String url;
|
||||
public String branch;
|
||||
public String revision;
|
||||
public String version;
|
||||
public String date;
|
||||
public String user;
|
||||
|
||||
public static LivyVersionResponse fromJson(String json) {
|
||||
return gson.fromJson(json, LivyVersionResponse.class);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class LivySparkSQLInterpreter extends BaseLivyInterprereter {
|
|||
// As we don't know whether livyserver use spark2 or spark1, so we will detect SparkSession
|
||||
// to judge whether it is using spark2.
|
||||
try {
|
||||
InterpreterResult result = sparkInterpreter.interpret("spark", false, false);
|
||||
InterpreterResult result = sparkInterpreter.interpret("spark", null, false, false);
|
||||
if (result.code() == InterpreterResult.Code.SUCCESS &&
|
||||
result.message().get(0).getData().contains("org.apache.spark.sql.SparkSession")) {
|
||||
LOGGER.info("SparkSession is detected so we are using spark 2.x for session {}",
|
||||
|
|
@ -59,7 +59,7 @@ public class LivySparkSQLInterpreter extends BaseLivyInterprereter {
|
|||
isSpark2 = true;
|
||||
} else {
|
||||
// spark 1.x
|
||||
result = sparkInterpreter.interpret("sqlContext", false, false);
|
||||
result = sparkInterpreter.interpret("sqlContext", null, false, false);
|
||||
if (result.code() == InterpreterResult.Code.SUCCESS) {
|
||||
LOGGER.info("sqlContext is detected.");
|
||||
} else if (result.code() == InterpreterResult.Code.ERROR) {
|
||||
|
|
@ -68,7 +68,7 @@ public class LivySparkSQLInterpreter extends BaseLivyInterprereter {
|
|||
LOGGER.info("sqlContext is not detected, try to create SQLContext by ourselves");
|
||||
result = sparkInterpreter.interpret(
|
||||
"val sqlContext = new org.apache.spark.sql.SQLContext(sc)\n"
|
||||
+ "import sqlContext.implicits._", false, false);
|
||||
+ "import sqlContext.implicits._", null, false, false);
|
||||
if (result.code() == InterpreterResult.Code.ERROR) {
|
||||
throw new LivyException("Fail to create SQLContext," +
|
||||
result.message().get(0).getData());
|
||||
|
|
@ -113,7 +113,8 @@ public class LivySparkSQLInterpreter extends BaseLivyInterprereter {
|
|||
} else {
|
||||
sqlQuery = "sqlContext.sql(\"\"\"" + line + "\"\"\").show(" + maxResult + ")";
|
||||
}
|
||||
InterpreterResult result = sparkInterpreter.interpret(sqlQuery, this.displayAppInfo, true);
|
||||
InterpreterResult result = sparkInterpreter.interpret(sqlQuery, context.getParagraphId(),
|
||||
this.displayAppInfo, true);
|
||||
|
||||
if (result.code() == InterpreterResult.Code.SUCCESS) {
|
||||
InterpreterResult result2 = new InterpreterResult(InterpreterResult.Code.SUCCESS);
|
||||
|
|
|
|||
96
livy/src/main/java/org/apache/zeppelin/livy/LivyVersion.java
Normal file
96
livy/src/main/java/org/apache/zeppelin/livy/LivyVersion.java
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
package org.apache.zeppelin.livy;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Provide reading comparing capability of livy version
|
||||
*/
|
||||
public class LivyVersion {
|
||||
private static final Logger logger = LoggerFactory.getLogger(LivyVersion.class);
|
||||
|
||||
private static final LivyVersion LIVY_0_2_0 = LivyVersion.fromVersionString("0.2.0");
|
||||
private static final LivyVersion LIVY_0_3_0 = LivyVersion.fromVersionString("0.3.0");
|
||||
|
||||
private int version;
|
||||
private String versionString;
|
||||
|
||||
LivyVersion(String versionString) {
|
||||
this.versionString = versionString;
|
||||
|
||||
try {
|
||||
int pos = versionString.indexOf('-');
|
||||
|
||||
String numberPart = versionString;
|
||||
if (pos > 0) {
|
||||
numberPart = versionString.substring(0, pos);
|
||||
}
|
||||
|
||||
String versions[] = numberPart.split("\\.");
|
||||
int major = Integer.parseInt(versions[0]);
|
||||
int minor = Integer.parseInt(versions[1]);
|
||||
int patch = Integer.parseInt(versions[2]);
|
||||
// version is always 5 digits. (e.g. 2.0.0 -> 20000, 1.6.2 -> 10602)
|
||||
version = Integer.parseInt(String.format("%d%02d%02d", major, minor, patch));
|
||||
} catch (Exception e) {
|
||||
logger.error("Can not recognize Livy version " + versionString +
|
||||
". Assume it's a future release", e);
|
||||
|
||||
// assume it is future release
|
||||
version = 99999;
|
||||
}
|
||||
}
|
||||
|
||||
public int toNumber() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return versionString;
|
||||
}
|
||||
|
||||
public static LivyVersion fromVersionString(String versionString) {
|
||||
return new LivyVersion(versionString);
|
||||
}
|
||||
|
||||
public boolean isCancelSupported() {
|
||||
return this.newerThanEquals(LIVY_0_3_0);
|
||||
}
|
||||
|
||||
public boolean equals(Object versionToCompare) {
|
||||
return version == ((LivyVersion) versionToCompare).version;
|
||||
}
|
||||
|
||||
public boolean newerThan(LivyVersion versionToCompare) {
|
||||
return version > versionToCompare.version;
|
||||
}
|
||||
|
||||
public boolean newerThanEquals(LivyVersion versionToCompare) {
|
||||
return version >= versionToCompare.version;
|
||||
}
|
||||
|
||||
public boolean olderThan(LivyVersion versionToCompare) {
|
||||
return version < versionToCompare.version;
|
||||
}
|
||||
|
||||
public boolean olderThanEquals(LivyVersion versionToCompare) {
|
||||
return version <= versionToCompare.version;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,9 +11,9 @@
|
|||
"defaultValue": "http://localhost:8998",
|
||||
"description": "The URL for Livy Server."
|
||||
},
|
||||
"zeppelin.livy.create.session.retries": {
|
||||
"envName": "ZEPPELIN_LIVY_CREATE_SESSION_RETRIES",
|
||||
"propertyName": "zeppelin.livy.create.session.timeout",
|
||||
"zeppelin.livy.session.create_timeout": {
|
||||
"envName": "ZEPPELIN_LIVY_SESSION_CREATE_TIMEOUT",
|
||||
"propertyName": "zeppelin.livy.session.create_timeout",
|
||||
"defaultValue": "120",
|
||||
"description": "Livy Server create session timeout (seconds)."
|
||||
},
|
||||
|
|
@ -77,12 +77,17 @@
|
|||
"defaultValue": "",
|
||||
"description": "Kerberos keytab to authenticate livy"
|
||||
},
|
||||
"zeppelin.livy.pull_status.interval.millis": {
|
||||
"propertyName": "zeppelin.livy.pull_status.interval.millis",
|
||||
"defaultValue": "1000",
|
||||
"description": "The interval for checking paragraph execution status"
|
||||
},
|
||||
"livy.spark.jars.packages": {
|
||||
"propertyName": "livy.spark.jars.packages",
|
||||
"defaultValue": "",
|
||||
"description": "Adding extra libraries to livy interpreter"
|
||||
},
|
||||
"livy.spark.displayAppInfo": {
|
||||
"zeppelin.livy.displayAppInfo": {
|
||||
"propertyName": "zeppelin.livy.displayAppInfo",
|
||||
"defaultValue": "false",
|
||||
"description": "Whether display app info"
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class LivyInterpreterIT {
|
|||
LOGGER.info("Starting livy at {}", cluster.livyEndpoint());
|
||||
properties = new Properties();
|
||||
properties.setProperty("zeppelin.livy.url", cluster.livyEndpoint());
|
||||
properties.setProperty("zeppelin.livy.create.session.timeout", "120");
|
||||
properties.setProperty("zeppelin.livy.session.create_timeout", "120");
|
||||
properties.setProperty("zeppelin.livy.spark.sql.maxResult", "100");
|
||||
}
|
||||
|
||||
|
|
@ -313,6 +313,38 @@ public class LivyInterpreterIT {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSparkInterpreterWithDisplayAppInfo() {
|
||||
if (!checkPreCondition()) {
|
||||
return;
|
||||
}
|
||||
InterpreterGroup interpreterGroup = new InterpreterGroup("group_1");
|
||||
interpreterGroup.put("session_1", new ArrayList<Interpreter>());
|
||||
Properties properties2 = new Properties(properties);
|
||||
properties2.put("zeppelin.livy.displayAppInfo", "true");
|
||||
// enable spark ui because it is disabled by livy integration test
|
||||
properties2.put("livy.spark.ui.enabled", "true");
|
||||
LivySparkInterpreter sparkInterpreter = new LivySparkInterpreter(properties2);
|
||||
sparkInterpreter.setInterpreterGroup(interpreterGroup);
|
||||
interpreterGroup.get("session_1").add(sparkInterpreter);
|
||||
AuthenticationInfo authInfo = new AuthenticationInfo("user1");
|
||||
MyInterpreterOutputListener outputListener = new MyInterpreterOutputListener();
|
||||
InterpreterOutput output = new InterpreterOutput(outputListener);
|
||||
InterpreterContext context = new InterpreterContext("noteId", "paragraphId", "livy.spark",
|
||||
"title", "text", authInfo, null, null, null, null, null, output);
|
||||
sparkInterpreter.open();
|
||||
|
||||
try {
|
||||
InterpreterResult result = sparkInterpreter.interpret("sc.version", context);
|
||||
assertEquals(InterpreterResult.Code.SUCCESS, result.code());
|
||||
assertEquals(2, result.message().size());
|
||||
assertTrue(result.message().get(0).getData().contains("1.5.2"));
|
||||
assertTrue(result.message().get(1).getData().contains("Spark Application Id"));
|
||||
} finally {
|
||||
sparkInterpreter.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSparkRInterpreter() {
|
||||
if (!checkPreCondition()) {
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-markdown</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Markdown interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-pig</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Apache Pig Interpreter</name>
|
||||
<description>Zeppelin interpreter for Apache Pig</description>
|
||||
<url>http://zeppelin.apache.org</url>
|
||||
|
|
|
|||
2
pom.xml
2
pom.xml
|
|
@ -24,7 +24,7 @@
|
|||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin</name>
|
||||
<description>Zeppelin project</description>
|
||||
<url>http://zeppelin.apache.org</url>
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-postgresql</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: PostgreSQL interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-python</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Python interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-scalding_2.10</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Scalding interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-scio_2.10</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Scio</name>
|
||||
<description>Zeppelin Scio support</description>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-shell</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Shell interpreter</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-spark-dependencies_2.10</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Spark dependencies</name>
|
||||
<description>Zeppelin spark support</description>
|
||||
|
||||
|
|
@ -523,9 +523,6 @@
|
|||
|
||||
<profile>
|
||||
<id>spark-2.0</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<spark.version>2.0.2</spark.version>
|
||||
<protobuf.version>2.5.0</protobuf.version>
|
||||
|
|
@ -534,6 +531,19 @@
|
|||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spark-2.1</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<spark.version>2.1.0</spark.version>
|
||||
<protobuf.version>2.5.0</protobuf.version>
|
||||
<py4j.version>0.10.4</py4j.version>
|
||||
<scala.version>2.11.8</scala.version>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>hadoop-0.23</id>
|
||||
<!-- SPARK-1121: Adds an explicit dependency on Avro to work around a
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-spark_2.10</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Spark</name>
|
||||
<description>Zeppelin spark support</description>
|
||||
|
||||
|
|
@ -515,9 +515,6 @@
|
|||
|
||||
<profile>
|
||||
<id>spark-2.0</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<spark.version>2.0.2</spark.version>
|
||||
<protobuf.version>2.5.0</protobuf.version>
|
||||
|
|
@ -526,6 +523,19 @@
|
|||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spark-2.1</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<spark.version>2.1.0</spark.version>
|
||||
<protobuf.version>2.5.0</protobuf.version>
|
||||
<py4j.version>0.10.4</py4j.version>
|
||||
<scala.version>2.11.8</scala.version>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>hadoop-0.23</id>
|
||||
<!-- SPARK-1121: Adds an explicit dependency on Avro to work around a
|
||||
|
|
|
|||
|
|
@ -488,8 +488,9 @@ public class SparkInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
//Only one of py4j-0.9-src.zip and py4j-0.8.2.1-src.zip should exist
|
||||
//TODO(zjffdu), this is not maintainable when new version is added.
|
||||
String[] pythonLibs = new String[]{"pyspark.zip", "py4j-0.9-src.zip", "py4j-0.8.2.1-src.zip",
|
||||
"py4j-0.10.1-src.zip", "py4j-0.10.3-src.zip"};
|
||||
"py4j-0.10.1-src.zip", "py4j-0.10.3-src.zip", "py4j-0.10.4-src.zip"};
|
||||
ArrayList<String> pythonLibUris = new ArrayList<>();
|
||||
for (String lib : pythonLibs) {
|
||||
File libFile = new File(pysparkPath, lib);
|
||||
|
|
@ -1452,8 +1453,10 @@ public class SparkInterpreter extends Interpreter {
|
|||
.getConstructor(new Class[]{
|
||||
SparkConf.class, File.class, SecurityManager.class, int.class, String.class});
|
||||
|
||||
return constructor.newInstance(new Object[] {
|
||||
conf, outputDir, new SecurityManager(conf), 0, "HTTP Server"});
|
||||
Object securityManager = createSecurityManager(conf);
|
||||
return constructor.newInstance(new Object[]{
|
||||
conf, outputDir, securityManager, 0, "HTTP Server"});
|
||||
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException |
|
||||
InstantiationException | InvocationTargetException e) {
|
||||
// fallback to old constructor
|
||||
|
|
@ -1464,7 +1467,7 @@ public class SparkInterpreter extends Interpreter {
|
|||
.getConstructor(new Class[]{
|
||||
File.class, SecurityManager.class, int.class, String.class});
|
||||
return constructor.newInstance(new Object[] {
|
||||
outputDir, new SecurityManager(conf), 0, "HTTP Server"});
|
||||
outputDir, createSecurityManager(conf), 0, "HTTP Server"});
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException |
|
||||
InstantiationException | InvocationTargetException e1) {
|
||||
logger.error(e1.getMessage(), e1);
|
||||
|
|
@ -1472,4 +1475,34 @@ public class SparkInterpreter extends Interpreter {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor signature of SecurityManager changes in spark 2.1.0, so we use this method to
|
||||
* create SecurityManager properly for different versions of spark
|
||||
*
|
||||
* @param conf
|
||||
* @return
|
||||
* @throws ClassNotFoundException
|
||||
* @throws NoSuchMethodException
|
||||
* @throws IllegalAccessException
|
||||
* @throws InvocationTargetException
|
||||
* @throws InstantiationException
|
||||
*/
|
||||
private Object createSecurityManager(SparkConf conf) throws ClassNotFoundException,
|
||||
NoSuchMethodException, IllegalAccessException, InvocationTargetException,
|
||||
InstantiationException {
|
||||
Object securityManager = null;
|
||||
try {
|
||||
Constructor<?> smConstructor = getClass().getClassLoader()
|
||||
.loadClass("org.apache.spark.SecurityManager")
|
||||
.getConstructor(new Class[]{ SparkConf.class, scala.Option.class });
|
||||
securityManager = smConstructor.newInstance(conf, null);
|
||||
} catch (NoSuchMethodException e) {
|
||||
Constructor<?> smConstructor = getClass().getClassLoader()
|
||||
.loadClass("org.apache.spark.SecurityManager")
|
||||
.getConstructor(new Class[]{ SparkConf.class });
|
||||
securityManager = smConstructor.newInstance(conf);
|
||||
}
|
||||
return securityManager;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.apache.zeppelin.spark;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Properties;
|
||||
|
|
@ -31,28 +31,27 @@ import org.apache.zeppelin.interpreter.*;
|
|||
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
public class DepInterpreterTest {
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder tmpDir = new TemporaryFolder();
|
||||
|
||||
private DepInterpreter dep;
|
||||
private InterpreterContext context;
|
||||
private File tmpDir;
|
||||
private SparkInterpreter repl;
|
||||
|
||||
private Properties getTestProperties() {
|
||||
private Properties getTestProperties() throws IOException {
|
||||
Properties p = new Properties();
|
||||
p.setProperty("zeppelin.dep.localrepo", "local-repo");
|
||||
p.setProperty("zeppelin.dep.localrepo", tmpDir.newFolder().getAbsolutePath());
|
||||
p.setProperty("zeppelin.dep.additionalRemoteRepository", "spark-packages,http://dl.bintray.com/spark-packages/maven,false;");
|
||||
return p;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
tmpDir = new File(System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis());
|
||||
System.setProperty("zeppelin.dep.localrepo", tmpDir.getAbsolutePath() + "/local-repo");
|
||||
|
||||
tmpDir.mkdirs();
|
||||
|
||||
Properties p = getTestProperties();
|
||||
|
||||
dep = new DepInterpreter(p);
|
||||
|
|
@ -74,20 +73,6 @@ public class DepInterpreterTest {
|
|||
@After
|
||||
public void tearDown() throws Exception {
|
||||
dep.close();
|
||||
delete(tmpDir);
|
||||
}
|
||||
|
||||
private void delete(File file) {
|
||||
if (file.isFile()) file.delete();
|
||||
else if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
if (files != null && files.length > 0) {
|
||||
for (File f : files) {
|
||||
delete(f);
|
||||
}
|
||||
}
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-display_2.10</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Display system apis</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-examples</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Examples</name>
|
||||
<description>Zeppelin examples</description>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin-examples</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-example-clock</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Example application - Clock</name>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"type" : "APPLICATION",
|
||||
"name" : "zeppelin.clock",
|
||||
"description" : "Clock (example)",
|
||||
"artifact" : "zeppelin-examples/zeppelin-example-clock/target/zeppelin-example-clock-0.7.0-SNAPSHOT.jar",
|
||||
"artifact" : "zeppelin-examples/zeppelin-example-clock/target/zeppelin-example-clock-0.8.0-SNAPSHOT.jar",
|
||||
"className" : "org.apache.zeppelin.example.app.clock.Clock",
|
||||
"resources" : [[":java.util.Date"]],
|
||||
"license" : "Apache-2.0",
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin-examples</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-example-horizontalbar</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Example application - Horizontal Bar chart</name>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-interpreter</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Interpreter</name>
|
||||
<description>Zeppelin Interpreter</description>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-server</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Server</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import javax.ws.rs.core.Response.Status;
|
|||
import com.google.gson.Gson;
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.apache.zeppelin.rest.message.RestartInterpreterRequest;
|
||||
import org.apache.zeppelin.utils.SecurityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.sonatype.aether.repository.RemoteRepository;
|
||||
|
|
@ -178,12 +179,11 @@ public class InterpreterRestApi {
|
|||
@ZeppelinApi
|
||||
public Response restartSetting(String message, @PathParam("settingId") String settingId) {
|
||||
logger.info("Restart interpreterSetting {}, msg={}", settingId, message);
|
||||
|
||||
try {
|
||||
RestartInterpreterRequest request = gson.fromJson(message, RestartInterpreterRequest.class);
|
||||
|
||||
String noteId = request == null ? null : request.getNoteId();
|
||||
interpreterFactory.restart(settingId, noteId);
|
||||
interpreterFactory.restart(settingId, noteId, SecurityUtils.getPrincipal());
|
||||
|
||||
} catch (InterpreterException e) {
|
||||
logger.error("Exception in InterpreterRestApi while restartSetting ", e);
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-web</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: web Application</name>
|
||||
|
||||
<!-- See https://github.com/eirslett/frontend-maven-plugin/issues/229 -->
|
||||
|
|
|
|||
|
|
@ -401,6 +401,13 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
|
||||
/** Set cron expression for this note **/
|
||||
$scope.setCronScheduler = function(cronExpr) {
|
||||
if (cronExpr) {
|
||||
if (!$scope.note.config.cronExecutingUser) {
|
||||
$scope.note.config.cronExecutingUser = $rootScope.ticket.principal;
|
||||
}
|
||||
} else {
|
||||
$scope.note.config.cronExecutingUser = '';
|
||||
}
|
||||
$scope.note.config.cron = cronExpr;
|
||||
$scope.setConfig();
|
||||
};
|
||||
|
|
@ -1011,4 +1018,3 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
|
|||
angular.element(document.getElementById('content')).css('padding-top', actionbarHeight - 20);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "zeppelin-tabledata",
|
||||
"description": "tabledata api",
|
||||
"version": "0.7.0-SNAPSHOT",
|
||||
"version": "0.8.0-SNAPSHOT",
|
||||
"main": "tabledata",
|
||||
"dependencies": {
|
||||
"json3": "~3.3.1",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "zeppelin-vis",
|
||||
"description": "Visualization API",
|
||||
"version": "0.7.0-SNAPSHOT",
|
||||
"version": "0.8.0-SNAPSHOT",
|
||||
"main": "visualization",
|
||||
"dependencies": {
|
||||
"json3": "~3.3.1",
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@
|
|||
<parent>
|
||||
<artifactId>zeppelin</artifactId>
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.zeppelin</groupId>
|
||||
<artifactId>zeppelin-zengine</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
<name>Zeppelin: Zengine</name>
|
||||
<description>Zeppelin Zengine</description>
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ public class HeliumVisualizationFactory {
|
|||
URL pkgUrl = Resources.getResource("helium/package.json");
|
||||
String pkgJson = Resources.toString(pkgUrl, Charsets.UTF_8);
|
||||
StringBuilder dependencies = new StringBuilder();
|
||||
StringBuilder cacheKeyBuilder = new StringBuilder();
|
||||
|
||||
FileFilter npmPackageCopyFilter = new FileFilter() {
|
||||
@Override
|
||||
|
|
@ -127,18 +128,25 @@ public class HeliumVisualizationFactory {
|
|||
dependencies.append(",\n");
|
||||
}
|
||||
dependencies.append("\"" + moduleNameVersion[0] + "\": \"" + moduleNameVersion[1] + "\"");
|
||||
cacheKeyBuilder.append(pkg.getName() + pkg.getArtifact());
|
||||
|
||||
File pkgInstallDir = new File(workingDirectory, "node_modules/" + pkg.getName());
|
||||
if (pkgInstallDir.exists()) {
|
||||
FileUtils.deleteDirectory(pkgInstallDir);
|
||||
}
|
||||
|
||||
if (isLocalPackage(pkg)) {
|
||||
FileUtils.copyDirectory(
|
||||
new File(pkg.getArtifact()),
|
||||
new File(workingDirectory, "node_modules/" + pkg.getName()),
|
||||
pkgInstallDir,
|
||||
npmPackageCopyFilter);
|
||||
}
|
||||
}
|
||||
pkgJson = pkgJson.replaceFirst("DEPENDENCIES", dependencies.toString());
|
||||
|
||||
// check if we can use previous bundle or not
|
||||
if (dependencies.toString().equals(bundleCacheKey) && currentBundle.isFile() && !forceRefresh) {
|
||||
if (cacheKeyBuilder.toString().equals(bundleCacheKey)
|
||||
&& currentBundle.isFile() && !forceRefresh) {
|
||||
return currentBundle;
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +185,10 @@ public class HeliumVisualizationFactory {
|
|||
// install tabledata module
|
||||
File tabledataModuleInstallPath = new File(workingDirectory,
|
||||
"node_modules/zeppelin-tabledata");
|
||||
if (tabledataModulePath != null && !tabledataModuleInstallPath.exists()) {
|
||||
if (tabledataModulePath != null) {
|
||||
if (tabledataModuleInstallPath.exists()) {
|
||||
FileUtils.deleteDirectory(tabledataModuleInstallPath);
|
||||
}
|
||||
FileUtils.copyDirectory(
|
||||
tabledataModulePath,
|
||||
tabledataModuleInstallPath,
|
||||
|
|
@ -187,7 +198,17 @@ public class HeliumVisualizationFactory {
|
|||
// install visualization module
|
||||
File visModuleInstallPath = new File(workingDirectory,
|
||||
"node_modules/zeppelin-vis");
|
||||
if (visualizationModulePath != null && !visModuleInstallPath.exists()) {
|
||||
if (visualizationModulePath != null) {
|
||||
if (visModuleInstallPath.exists()) {
|
||||
// when zeppelin-vis and zeppelin-table package is published to npm repository
|
||||
// we don't need to remove module because npm install command will take care
|
||||
// dependency version change. However, when two dependencies are copied manually
|
||||
// into node_modules directory, changing vis package version results inconsistent npm
|
||||
// install behavior.
|
||||
//
|
||||
// Remote vis package everytime and let npm download every time bundle as a workaround
|
||||
FileUtils.deleteDirectory(visModuleInstallPath);
|
||||
}
|
||||
FileUtils.copyDirectory(visualizationModulePath, visModuleInstallPath, npmPackageCopyFilter);
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +231,7 @@ public class HeliumVisualizationFactory {
|
|||
synchronized (this) {
|
||||
currentBundle.delete();
|
||||
FileUtils.moveFile(visBundleJs, currentBundle);
|
||||
bundleCacheKey = dependencies.toString();
|
||||
bundleCacheKey = cacheKeyBuilder.toString();
|
||||
}
|
||||
return currentBundle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -737,7 +737,7 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
String noteId) {
|
||||
InterpreterOption option = interpreterSetting.getOption();
|
||||
if (option.isProcess()) {
|
||||
interpreterSetting.closeAndRemoveInterpreterGroup(noteId);
|
||||
interpreterSetting.closeAndRemoveInterpreterGroupByNoteId(noteId);
|
||||
} else if (option.isSession()) {
|
||||
InterpreterGroup interpreterGroup = interpreterSetting.getInterpreterGroup(user, noteId);
|
||||
String key = getInterpreterSessionKey(user, noteId, interpreterSetting);
|
||||
|
|
@ -971,18 +971,23 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
return noteId == null ? false : true;
|
||||
}
|
||||
|
||||
public void restart(String settingId, String noteId) {
|
||||
public void restart(String settingId, String noteId, String user) {
|
||||
InterpreterSetting intpSetting = interpreterSettings.get(settingId);
|
||||
Preconditions.checkNotNull(intpSetting);
|
||||
|
||||
// restart interpreter setting in note page
|
||||
if (noteIdIsExist(noteId) && intpSetting.getOption().isProcess()) {
|
||||
intpSetting.closeAndRemoveInterpreterGroup(noteId);
|
||||
intpSetting.closeAndRemoveInterpreterGroupByNoteId(noteId);
|
||||
return;
|
||||
} else {
|
||||
// restart interpreter setting in interpreter setting page
|
||||
restart(settingId, user);
|
||||
}
|
||||
restart(settingId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void restart(String id) {
|
||||
public void restart(String id, String user) {
|
||||
synchronized (interpreterSettings) {
|
||||
InterpreterSetting intpSetting = interpreterSettings.get(id);
|
||||
// Check if dependency in specified path is changed
|
||||
|
|
@ -993,8 +998,11 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
copyDependenciesFromLocalPath(intpSetting);
|
||||
|
||||
stopJobAllInterpreter(intpSetting);
|
||||
|
||||
intpSetting.closeAndRemoveAllInterpreterGroups();
|
||||
if (user.equals("anonymous")) {
|
||||
intpSetting.closeAndRemoveAllInterpreterGroups();
|
||||
} else {
|
||||
intpSetting.closeAndRemoveInterpreterGroupByUser(user);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new InterpreterException("Interpreter setting id " + id + " not found");
|
||||
|
|
@ -1002,6 +1010,10 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
}
|
||||
}
|
||||
|
||||
public void restart(String id) {
|
||||
restart(id, "anonymous");
|
||||
}
|
||||
|
||||
private void stopJobAllInterpreter(InterpreterSetting intpSetting) {
|
||||
if (intpSetting != null) {
|
||||
for (InterpreterGroup intpGroup : intpSetting.getAllInterpreterGroups()) {
|
||||
|
|
|
|||
|
|
@ -144,6 +144,26 @@ public class InterpreterSetting {
|
|||
return key;
|
||||
}
|
||||
|
||||
private String getInterpreterSessionKey(String user, String noteId) {
|
||||
InterpreterOption option = getOption();
|
||||
String key;
|
||||
if (option.isExistingProcess()) {
|
||||
key = Constants.EXISTING_PROCESS;
|
||||
} else if (option.perNoteScoped() && option.perUserScoped()) {
|
||||
key = user + ":" + noteId;
|
||||
} else if (option.perUserScoped()) {
|
||||
key = user;
|
||||
} else if (option.perNoteScoped()) {
|
||||
key = noteId;
|
||||
} else {
|
||||
key = "shared_session";
|
||||
}
|
||||
|
||||
logger.debug("Interpreter session key: {}, for note: {}, user: {}, InterpreterSetting Name: " +
|
||||
"{}", key, noteId, user, getName());
|
||||
return key;
|
||||
}
|
||||
|
||||
public InterpreterGroup getInterpreterGroup(String user, String noteId) {
|
||||
String key = getInterpreterProcessKey(user, noteId);
|
||||
if (!interpreterGroupRef.containsKey(key)) {
|
||||
|
|
@ -173,7 +193,7 @@ public class InterpreterSetting {
|
|||
}
|
||||
}
|
||||
|
||||
void closeAndRemoveInterpreterGroup(String noteId) {
|
||||
void closeAndRemoveInterpreterGroupByNoteId(String noteId) {
|
||||
String key = getInterpreterProcessKey("", noteId);
|
||||
|
||||
InterpreterGroup groupToRemove = null;
|
||||
|
|
@ -190,10 +210,30 @@ public class InterpreterSetting {
|
|||
}
|
||||
}
|
||||
|
||||
void closeAndRemoveInterpreterGroupByUser(String user) {
|
||||
if (user.equals("anonymous")) {
|
||||
user = "";
|
||||
}
|
||||
String processKey = getInterpreterProcessKey(user, "");
|
||||
String sessionKey = getInterpreterSessionKey(user, "");
|
||||
InterpreterGroup groupToRemove = null;
|
||||
for (String intpKey : new HashSet<>(interpreterGroupRef.keySet())) {
|
||||
if (intpKey.contains(processKey)) {
|
||||
interpreterGroupWriteLock.lock();
|
||||
groupToRemove = interpreterGroupRef.remove(intpKey);
|
||||
interpreterGroupWriteLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
if (groupToRemove != null) {
|
||||
groupToRemove.close(sessionKey);
|
||||
}
|
||||
}
|
||||
|
||||
void closeAndRemoveAllInterpreterGroups() {
|
||||
HashSet<String> groupsToRemove = new HashSet<>(interpreterGroupRef.keySet());
|
||||
for (String key : groupsToRemove) {
|
||||
closeAndRemoveInterpreterGroup(key);
|
||||
closeAndRemoveInterpreterGroupByNoteId(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ public class Paragraph extends Job implements Serializable, Cloneable {
|
|||
if (job != null) {
|
||||
job.setStatus(Status.ABORT);
|
||||
} else {
|
||||
repl.cancel(getInterpreterContext(null));
|
||||
repl.cancel(getInterpreterContextWithoutRunner(null));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -498,6 +498,34 @@ public class Paragraph extends Job implements Serializable, Cloneable {
|
|||
}));
|
||||
}
|
||||
|
||||
private InterpreterContext getInterpreterContextWithoutRunner(InterpreterOutput output) {
|
||||
AngularObjectRegistry registry = null;
|
||||
ResourcePool resourcePool = null;
|
||||
|
||||
if (!factory.getInterpreterSettings(note.getId()).isEmpty()) {
|
||||
InterpreterSetting intpGroup = factory.getInterpreterSettings(note.getId()).get(0);
|
||||
registry = intpGroup.getInterpreterGroup(getUser(), note.getId()).getAngularObjectRegistry();
|
||||
resourcePool = intpGroup.getInterpreterGroup(getUser(), note.getId()).getResourcePool();
|
||||
}
|
||||
|
||||
List<InterpreterContextRunner> runners = new LinkedList<>();
|
||||
|
||||
final Paragraph self = this;
|
||||
|
||||
Credentials credentials = note.getCredentials();
|
||||
if (authenticationInfo != null) {
|
||||
UserCredentials userCredentials =
|
||||
credentials.getUserCredentials(authenticationInfo.getUser());
|
||||
authenticationInfo.setUserCredentials(userCredentials);
|
||||
}
|
||||
|
||||
InterpreterContext interpreterContext =
|
||||
new InterpreterContext(note.getId(), getId(), getRequiredReplName(), this.getTitle(),
|
||||
this.getText(), this.getAuthenticationInfo(), this.getConfig(), this.settings, registry,
|
||||
resourcePool, runners, output);
|
||||
return interpreterContext;
|
||||
}
|
||||
|
||||
private InterpreterContext getInterpreterContext(InterpreterOutput output) {
|
||||
AngularObjectRegistry registry = null;
|
||||
ResourcePool resourcePool = null;
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@ import java.net.URL;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HeliumVisualizationFactoryTest {
|
||||
private File tmpDir;
|
||||
|
|
@ -154,4 +152,42 @@ public class HeliumVisualizationFactoryTest {
|
|||
}
|
||||
assertNull(bundle);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void switchVersion() throws IOException, TaskRunnerException {
|
||||
URL res = Resources.getResource("helium/webpack.config.js");
|
||||
String resDir = new File(res.getFile()).getParent();
|
||||
|
||||
HeliumPackage pkgV1 = new HeliumPackage(
|
||||
HeliumPackage.Type.VISUALIZATION,
|
||||
"zeppelin-bubblechart",
|
||||
"zeppelin-bubblechart",
|
||||
"zeppelin-bubblechart@0.0.3",
|
||||
"",
|
||||
null,
|
||||
"license",
|
||||
"icon"
|
||||
);
|
||||
|
||||
HeliumPackage pkgV2 = new HeliumPackage(
|
||||
HeliumPackage.Type.VISUALIZATION,
|
||||
"zeppelin-bubblechart",
|
||||
"zeppelin-bubblechart",
|
||||
"zeppelin-bubblechart@0.0.1",
|
||||
"",
|
||||
null,
|
||||
"license",
|
||||
"icon"
|
||||
);
|
||||
List<HeliumPackage> pkgsV1 = new LinkedList<>();
|
||||
pkgsV1.add(pkgV1);
|
||||
|
||||
List<HeliumPackage> pkgsV2 = new LinkedList<>();
|
||||
pkgsV2.add(pkgV2);
|
||||
|
||||
File bundle1 = hvf.bundle(pkgsV1);
|
||||
File bundle2 = hvf.bundle(pkgsV2);
|
||||
|
||||
assertNotSame(bundle1.lastModified(), bundle2.lastModified());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,79 @@ public class InterpreterFactoryTest {
|
|||
assertEquals("value_2", remoteInterpreter.getProperty("property_2"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 users' interpreters in scoped mode. Each user has one session. Restarting user1's interpreter
|
||||
* won't affect user2's interpreter
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testRestartInterpreterInScopedMode() throws Exception {
|
||||
factory = new InterpreterFactory(conf, new InterpreterOption(true), null, null, null, depResolver, false);
|
||||
List<InterpreterSetting> all = factory.get();
|
||||
InterpreterSetting mock1Setting = null;
|
||||
for (InterpreterSetting setting : all) {
|
||||
if (setting.getName().equals("mock1")) {
|
||||
mock1Setting = setting;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mock1Setting.getOption().setPerUser("scoped");
|
||||
mock1Setting.getOption().setPerNote("shared");
|
||||
// set remote as false so that we won't create new remote interpreter process
|
||||
mock1Setting.getOption().setRemote(false);
|
||||
mock1Setting.getOption().setHost("localhost");
|
||||
mock1Setting.getOption().setPort(2222);
|
||||
InterpreterGroup interpreterGroup = mock1Setting.getInterpreterGroup("user1", "sharedProcess");
|
||||
factory.createInterpretersForNote(mock1Setting, "user1", "sharedProcess", "user1");
|
||||
factory.createInterpretersForNote(mock1Setting, "user2", "sharedProcess", "user2");
|
||||
|
||||
LazyOpenInterpreter interpreter1 = (LazyOpenInterpreter)interpreterGroup.get("user1").get(0);
|
||||
interpreter1.open();
|
||||
LazyOpenInterpreter interpreter2 = (LazyOpenInterpreter)interpreterGroup.get("user2").get(0);
|
||||
interpreter2.open();
|
||||
|
||||
mock1Setting.closeAndRemoveInterpreterGroupByUser("user1");
|
||||
assertFalse(interpreter1.isOpen());
|
||||
assertTrue(interpreter2.isOpen());
|
||||
}
|
||||
|
||||
/**
|
||||
* 2 users' interpreters in isolated mode. Each user has one interpreterGroup. Restarting user1's interpreter
|
||||
* won't affect user2's interpreter
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testRestartInterpreterInIsolatedMode() throws Exception {
|
||||
factory = new InterpreterFactory(conf, new InterpreterOption(true), null, null, null, depResolver, false);
|
||||
List<InterpreterSetting> all = factory.get();
|
||||
InterpreterSetting mock1Setting = null;
|
||||
for (InterpreterSetting setting : all) {
|
||||
if (setting.getName().equals("mock1")) {
|
||||
mock1Setting = setting;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mock1Setting.getOption().setPerUser("isolated");
|
||||
mock1Setting.getOption().setPerNote("shared");
|
||||
// set remote as false so that we won't create new remote interpreter process
|
||||
mock1Setting.getOption().setRemote(false);
|
||||
mock1Setting.getOption().setHost("localhost");
|
||||
mock1Setting.getOption().setPort(2222);
|
||||
InterpreterGroup interpreterGroup1 = mock1Setting.getInterpreterGroup("user1", "note1");
|
||||
InterpreterGroup interpreterGroup2 = mock1Setting.getInterpreterGroup("user2", "note2");
|
||||
factory.createInterpretersForNote(mock1Setting, "user1", "note1", "shared_session");
|
||||
factory.createInterpretersForNote(mock1Setting, "user2", "note2", "shared_session");
|
||||
|
||||
LazyOpenInterpreter interpreter1 = (LazyOpenInterpreter)interpreterGroup1.get("shared_session").get(0);
|
||||
interpreter1.open();
|
||||
LazyOpenInterpreter interpreter2 = (LazyOpenInterpreter)interpreterGroup2.get("shared_session").get(0);
|
||||
interpreter2.open();
|
||||
|
||||
mock1Setting.closeAndRemoveInterpreterGroupByUser("user1");
|
||||
assertFalse(interpreter1.isOpen());
|
||||
assertTrue(interpreter2.isOpen());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFactoryDefaultList() throws IOException, RepositoryException {
|
||||
// get default settings
|
||||
|
|
@ -365,9 +438,4 @@ public class InterpreterFactoryTest {
|
|||
interpreterRunner = ((RemoteInterpreter) ((LazyOpenInterpreter) i).getInnerInterpreter()).getInterpreterRunner();
|
||||
assertEquals(interpreterRunner, testInterpreterRunner);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void interpreterRunnerAsAbsolutePathTest() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue