You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2019/08/05 02:32:35 UTC

[zeppelin] branch master updated: ZEPPELIN-4275. No error message when no interpreter is found

This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new 09c8d13  ZEPPELIN-4275. No error message when no interpreter is found
09c8d13 is described below

commit 09c8d1336a8b6e178be4df3628bb34a946c476da
Author: Jeff Zhang <zj...@apache.org>
AuthorDate: Tue Jul 30 19:45:38 2019 +0800

    ZEPPELIN-4275. No error message when no interpreter is found
    
    ### What is this PR for?
    
    This is a trivial PR to display an error message when user specifies invalid interpreter name.
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://jira.apache.org/jira/browse/ZEPPELIN-4275
    
    ### How should this be tested?
    * CI pass
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Jeff Zhang <zj...@apache.org>
    
    Closes #3417 from zjffdu/ZEPPELIN-4275 and squashes the following commits:
    
    841f70c93 [Jeff Zhang] ZEPPELIN-4275. No error message when no interpreter is found
---
 .../java/org/apache/zeppelin/notebook/Paragraph.java    |  5 +++--
 .../java/org/apache/zeppelin/notebook/NotebookTest.java | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
index 5865df2..0100afe 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
@@ -426,10 +426,11 @@ public class Paragraph extends JobWithProgressPoller<InterpreterResult> implemen
       }
     } catch (InterpreterNotFoundException e) {
       InterpreterResult intpResult =
-          new InterpreterResult(InterpreterResult.Code.ERROR);
+          new InterpreterResult(InterpreterResult.Code.ERROR,
+                  String.format("Interpreter %s not found", this.intpText));
       setReturn(intpResult, e);
       setStatus(Job.Status.ERROR);
-      throw new RuntimeException(e);
+      return false;
     }
   }
 
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
index 49023e7..5a984ae 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
@@ -433,6 +433,23 @@ public class NotebookTest extends AbstractInterpreterTest implements ParagraphJo
   }
 
   @Test
+  public void testInvalidInterpreter() throws IOException, InterruptedException {
+    Note note = notebook.createNote("note1", anonymous);
+    Paragraph p1 = note.addNewParagraph(AuthenticationInfo.ANONYMOUS);
+    p1.setText("%invalid abc");
+    p1.setAuthenticationInfo(anonymous);
+    note.run(p1.getId());
+
+    Thread.sleep(2 * 1000);
+    assertEquals(p1.getStatus(), Status.ERROR);
+    InterpreterResult result = p1.getReturn();
+    assertEquals(InterpreterResult.Code.ERROR, result.code());
+    assertEquals("Interpreter invalid not found", result.message().get(0).getData());
+    assertNull(p1.getDateStarted());
+    notebook.removeNote(note.getId(), anonymous);
+  }
+
+  @Test
   public void testRunAll() throws IOException {
     Note note = notebook.createNote("note1", anonymous);