You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2016/11/20 16:13:29 UTC

zeppelin git commit: [ZEPPELIN-1622] Remove %dep interpreter deprecated message

Repository: zeppelin
Updated Branches:
  refs/heads/master 8c087c1b8 -> 85c50a8ab


[ZEPPELIN-1622] Remove %dep interpreter deprecated message

### What is this PR for?
%dep interpreter was going to be deprecated, but we had feedback from many users that this feature provide different advantage over dependency loading via GUI so we want to keep supporting it. This PR remove deprecated message when users use %dep interpreter.

### Todos
- [x] Fix test

### What type of PR is it?
Documentation

### What is the Jira issue?
[ZEPPELIN-1622](https://issues.apache.org/jira/browse/ZEPPELIN-1622)

### How should this be tested?
Run %dep interpreter such as `z.load('/your/library.jar)` and see if deprecated message is gone.

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

Author: Mina Lee <mi...@apache.org>

Closes #1605 from minahlee/ZEPPELIN-1622 and squashes the following commits:

b604c4c [Mina Lee] Add %dep z.load integration test
e3ae4c8 [Mina Lee] Remove %dep interpreter deprecated message


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

Branch: refs/heads/master
Commit: 85c50a8aba81bcb0570f36a1f5cda3e2fabe96e1
Parents: 8c087c1
Author: Mina Lee <mi...@apache.org>
Authored: Fri Nov 18 23:35:29 2016 +0100
Committer: Lee moon soo <mo...@apache.org>
Committed: Sun Nov 20 08:13:25 2016 -0800

----------------------------------------------------------------------
 docs/interpreter/spark.md                       |  3 +-
 .../spark/dep/SparkDependencyContext.java       |  8 ---
 .../zeppelin/integration/SparkParagraphIT.java  | 58 ++++++++++++++++++--
 3 files changed, 54 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/85c50a8a/docs/interpreter/spark.md
----------------------------------------------------------------------
diff --git a/docs/interpreter/spark.md b/docs/interpreter/spark.md
index 44ef4f4..59f7f2c 100644
--- a/docs/interpreter/spark.md
+++ b/docs/interpreter/spark.md
@@ -228,8 +228,7 @@ Here are few examples:
   ```
 
 ### 3. Dynamic Dependency Loading via %spark.dep interpreter
-> Note: `%spark.dep` interpreter is deprecated since v0.6.0.
-`%spark.dep` interpreter loads libraries to `%spark` and `%spark.pyspark` but not to  `%spark.sql` interpreter. So we recommend you to use the first option instead.
+> Note: `%spark.dep` interpreter loads libraries to `%spark` and `%spark.pyspark` but not to  `%spark.sql` interpreter. So we recommend you to use the first option instead.
 
 When your code requires external library, instead of doing download/copy/restart Zeppelin, you can easily do following jobs using `%spark.dep` interpreter.
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/85c50a8a/spark/src/main/java/org/apache/zeppelin/spark/dep/SparkDependencyContext.java
----------------------------------------------------------------------
diff --git a/spark/src/main/java/org/apache/zeppelin/spark/dep/SparkDependencyContext.java b/spark/src/main/java/org/apache/zeppelin/spark/dep/SparkDependencyContext.java
index 59d8d4a..0235fc6 100644
--- a/spark/src/main/java/org/apache/zeppelin/spark/dep/SparkDependencyContext.java
+++ b/spark/src/main/java/org/apache/zeppelin/spark/dep/SparkDependencyContext.java
@@ -42,8 +42,6 @@ import org.sonatype.aether.util.artifact.JavaScopes;
 import org.sonatype.aether.util.filter.DependencyFilterUtils;
 import org.sonatype.aether.util.filter.PatternExclusionsDependencyFilter;
 
-import scala.Console;
-
 
 /**
  *
@@ -66,8 +64,6 @@ public class SparkDependencyContext {
   }
 
   public Dependency load(String lib) {
-    Console.println("DepInterpreter(%dep) deprecated. "
-        + "Load dependency through GUI interpreter menu instead.");
     Dependency dep = new Dependency(lib);
 
     if (dependencies.contains(dep)) {
@@ -78,16 +74,12 @@ public class SparkDependencyContext {
   }
 
   public Repository addRepo(String name) {
-    Console.println("DepInterpreter(%dep) deprecated. "
-        + "Add repository through GUI interpreter menu instead.");
     Repository rep = new Repository(name);
     repositories.add(rep);
     return rep;
   }
 
   public void reset() {
-    Console.println("DepInterpreter(%dep) deprecated. "
-        + "Remove dependencies and repositories through GUI interpreter menu instead.");
     dependencies = new LinkedList<>();
     repositories = new LinkedList<>();
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/85c50a8a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/SparkParagraphIT.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/SparkParagraphIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/SparkParagraphIT.java
index 5009076..5157501 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/SparkParagraphIT.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/SparkParagraphIT.java
@@ -35,7 +35,6 @@ import org.slf4j.LoggerFactory;
 public class SparkParagraphIT extends AbstractZeppelinIT {
   private static final Logger LOG = LoggerFactory.getLogger(SparkParagraphIT.class);
 
-
   @Rule
   public ErrorCollector collector = new ErrorCollector();
 
@@ -142,8 +141,8 @@ public class SparkParagraphIT extends AbstractZeppelinIT {
 
       // the last statement's evaluation result is printed
       setTextOfParagraph(2, "%pyspark\\n" +
-              "sc.version\\n" +
-              "1+1");
+          "sc.version\\n" +
+          "1+1");
       runParagraph(2);
       try {
         waitForParagraph(2, "FINISHED");
@@ -154,9 +153,9 @@ public class SparkParagraphIT extends AbstractZeppelinIT {
         );
       }
       WebElement paragraph2Result = driver.findElement(By.xpath(
-              getParagraphXPath(2) + "//div[@class=\"tableDisplay\"]"));
+          getParagraphXPath(2) + "//div[@class=\"tableDisplay\"]"));
       collector.checkThat("Paragraph from SparkParagraphIT of testPySpark result: ",
-              paragraph2Result.getText().toString(), CoreMatchers.equalTo("2")
+          paragraph2Result.getText().toString(), CoreMatchers.equalTo("2")
       );
 
     } catch (Exception e) {
@@ -192,4 +191,53 @@ public class SparkParagraphIT extends AbstractZeppelinIT {
       handleException("Exception in SparkParagraphIT while testSqlSpark", e);
     }
   }
+
+  @Test
+  public void testDep() throws Exception {
+    if (!endToEndTestEnabled()) {
+      return;
+    }
+    try {
+      // restart spark interpreter before running %dep
+      clickAndWait(By.xpath("//span[@tooltip='Interpreter binding']"));
+      clickAndWait(By.xpath("//div[font[contains(text(), 'spark')]]/preceding-sibling::a[@tooltip='Restart']"));
+      clickAndWait(By.xpath("//button[contains(.,'OK')]"));
+
+      setTextOfParagraph(1,"%dep z.load(\"org.apache.commons:commons-csv:1.1\")");
+      runParagraph(1);
+
+      try {
+        waitForParagraph(1, "FINISHED");
+        WebElement paragraph1Result = driver.findElement(By.xpath(getParagraphXPath(1) +
+            "//div[@class='text']"));
+        collector.checkThat("Paragraph from SparkParagraphIT of testSqlSpark result: ",
+            paragraph1Result.getText(), CoreMatchers.containsString("res0: org.apache.zeppelin.dep.Dependency = org.apache.zeppelin.dep.Dependency"));
+
+        setTextOfParagraph(2, "import org.apache.commons.csv.CSVFormat");
+        runParagraph(2);
+
+        try {
+          waitForParagraph(2, "FINISHED");
+          WebElement paragraph2Result = driver.findElement(By.xpath(getParagraphXPath(2) +
+              "//div[@class='text']"));
+          collector.checkThat("Paragraph from SparkParagraphIT of testSqlSpark result: ",
+              paragraph2Result.getText(), CoreMatchers.equalTo("import org.apache.commons.csv.CSVFormat"));
+
+        } catch (TimeoutException e) {
+          waitForParagraph(2, "ERROR");
+          collector.checkThat("Second paragraph from SparkParagraphIT of testDep status: ",
+              "ERROR", CoreMatchers.equalTo("FINISHED")
+          );
+        }
+
+      } catch (TimeoutException e) {
+        waitForParagraph(1, "ERROR");
+        collector.checkThat("First paragraph from SparkParagraphIT of testDep status: ",
+            "ERROR", CoreMatchers.equalTo("FINISHED")
+        );
+      }
+    } catch (Exception e) {
+      handleException("Exception in SparkParagraphIT while testDep", e);
+    }
+  }
 }