zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjf...@apache.org
Subject zeppelin git commit: ZEPPELIN-3637. Allow custom spark UI url for new spark interpreter
Date Mon, 23 Jul 2018 08:13:43 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.8 e133507da -> 22f79cf69


ZEPPELIN-3637. Allow custom spark UI url for new spark interpreter

Trivia fix to allow custom spark UI url for new spark interpreter

[Bug Fix]

* [ ] - Task

* https://issues.apache.org/jira/browse/ZEPPELIN-3637

* CI pass

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

Author: Jeff Zhang <zjffdu@apache.org>

Closes #3083 from zjffdu/ZEPPELIN-3637 and squashes the following commits:

9789e975e [Jeff Zhang] ZEPPELIN-3637. Allow custom spark UI url for new spark interpreter

(cherry picked from commit 30aa87948f4b92e95a695e95b94e8157fa3af938)
Signed-off-by: Jeff Zhang <zjffdu@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/22f79cf6
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/22f79cf6
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/22f79cf6

Branch: refs/heads/branch-0.8
Commit: 22f79cf6929e587c87b3780f368af2614f0010f3
Parents: e133507
Author: Jeff Zhang <zjffdu@apache.org>
Authored: Thu Jul 19 08:30:11 2018 +0800
Committer: Jeff Zhang <zjffdu@apache.org>
Committed: Mon Jul 23 16:13:33 2018 +0800

----------------------------------------------------------------------
 .../apache/zeppelin/spark/NewSparkInterpreter.java   |  4 ++++
 .../zeppelin/spark/NewSparkInterpreterTest.java      | 15 +++++++++++++--
 .../zeppelin/interpreter/InterpreterContext.java     |  5 +++++
 3 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/22f79cf6/spark/interpreter/src/main/java/org/apache/zeppelin/spark/NewSparkInterpreter.java
----------------------------------------------------------------------
diff --git a/spark/interpreter/src/main/java/org/apache/zeppelin/spark/NewSparkInterpreter.java
b/spark/interpreter/src/main/java/org/apache/zeppelin/spark/NewSparkInterpreter.java
index 9f7d03d..1f28d82 100644
--- a/spark/interpreter/src/main/java/org/apache/zeppelin/spark/NewSparkInterpreter.java
+++ b/spark/interpreter/src/main/java/org/apache/zeppelin/spark/NewSparkInterpreter.java
@@ -112,6 +112,10 @@ public class NewSparkInterpreter extends AbstractSparkInterpreter {
       sqlContext = this.innerInterpreter.sqlContext();
       sparkSession = this.innerInterpreter.sparkSession();
       sparkUrl = this.innerInterpreter.sparkUrl();
+      String sparkUrlProp = getProperty("zeppelin.spark.uiWebUrl", "");
+      if (!StringUtils.isBlank(sparkUrlProp)) {
+        sparkUrl = sparkUrlProp;
+      }
       sparkShims = SparkShims.getInstance(sc.version());
       sparkShims.setupSparkListener(sc.master(), sparkUrl);
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/22f79cf6/spark/interpreter/src/test/java/org/apache/zeppelin/spark/NewSparkInterpreterTest.java
----------------------------------------------------------------------
diff --git a/spark/interpreter/src/test/java/org/apache/zeppelin/spark/NewSparkInterpreterTest.java
b/spark/interpreter/src/test/java/org/apache/zeppelin/spark/NewSparkInterpreterTest.java
index 25a400c..38857f1 100644
--- a/spark/interpreter/src/test/java/org/apache/zeppelin/spark/NewSparkInterpreterTest.java
+++ b/spark/interpreter/src/test/java/org/apache/zeppelin/spark/NewSparkInterpreterTest.java
@@ -77,13 +77,24 @@ public class NewSparkInterpreterTest {
     properties.setProperty("zeppelin.spark.maxResult", "100");
     properties.setProperty("zeppelin.spark.test", "true");
     properties.setProperty("zeppelin.spark.useNew", "true");
+    properties.setProperty("zeppelin.spark.uiWebUrl", "fake_spark_weburl");
+
+    mockRemoteEventClient = mock(RemoteEventClient.class);
+    InterpreterContext context = InterpreterContext.builder()
+        .setInterpreterOut(new InterpreterOutput(null))
+        .build();
+    InterpreterContext.set(context);
+
     interpreter = new SparkInterpreter(properties);
     assertTrue(interpreter.getDelegation() instanceof NewSparkInterpreter);
     interpreter.setInterpreterGroup(mock(InterpreterGroup.class));
     interpreter.open();
 
-    mockRemoteEventClient = mock(RemoteEventClient.class);
     interpreter.getZeppelinContext().setEventClient(mockRemoteEventClient);
+
+
+    assertEquals("fake_spark_weburl", interpreter.getSparkUIUrl());
+
     InterpreterResult result = interpreter.interpret("val a=\"hello world\"", getInterpreterContext());
     assertEquals(InterpreterResult.Code.SUCCESS, result.code());
     assertEquals("a: String = hello world\n", output);
@@ -204,7 +215,7 @@ public class NewSparkInterpreterTest {
     messageOutput.flush();
     assertEquals("_1\t_2\n1\ta\n2\tb\n", messageOutput.toInterpreterResultMessage().getData());
 
-    InterpreterContext context = getInterpreterContext();
+    context = getInterpreterContext();
     result = interpreter.interpret("z.input(\"name\", \"default_name\")", context);
     assertEquals(InterpreterResult.Code.SUCCESS, result.code());
     assertEquals(1, context.getGui().getForms().size());

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/22f79cf6/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java
b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java
index 346ae85..cb44464 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java
@@ -98,6 +98,11 @@ public class InterpreterContext {
       return this;
     }
 
+    public Builder setInterpreterOut(InterpreterOutput out) {
+      context.out = out;
+      return this;
+    }
+
     public InterpreterContext build() {
       return context;
     }


Mime
View raw message