zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjf...@apache.org
Subject [zeppelin] branch master updated: [ZEPPELIN-4322] Flaky test: NotebookRestApiTest#testRunWithServerRestart
Date Wed, 18 Sep 2019 02:09:21 GMT
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 21cca11  [ZEPPELIN-4322] Flaky test: NotebookRestApiTest#testRunWithServerRestart
21cca11 is described below

commit 21cca11400aaa2cd603461d8600c5a1fc7ed4afe
Author: Jeff Zhang <zjffdu@apache.org>
AuthorDate: Tue Sep 10 21:57:29 2019 +0800

    [ZEPPELIN-4322] Flaky test: NotebookRestApiTest#testRunWithServerRestart
    
    ### What is this PR for?
    The root cause of this flaky test is due to that the note may be removed when paragraph
job is still running. And the job will still send rpc message to zeppelin-server side which
may cause unexpected exception.
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-4322
    
    ### 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 <zjffdu@apache.org>
    
    Closes #3448 from zjffdu/ZEPPELIN-4322 and squashes the following commits:
    
    b31f38f68 [Jeff Zhang] [ZEPPELIN-4322] Flaky test: NotebookRestApiTest#testRunWithServerRestart
---
 .../org/apache/zeppelin/socket/NotebookServer.java    | 19 ++++++++++++++-----
 .../apache/zeppelin/cluster/ZeppelinServerMock.java   |  6 ++++++
 .../org/apache/zeppelin/notebook/NoteManager.java     |  1 +
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
index 0bfd389..ce3f9b6 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
@@ -1603,10 +1603,14 @@ public class NotebookServer extends WebSocketServlet
   @Override
   public void onOutputClear(String noteId, String paragraphId) {
     final Note note = getNotebook().getNote(noteId);
-
-    note.clearParagraphOutput(paragraphId);
-    Paragraph paragraph = note.getParagraph(paragraphId);
-    broadcastParagraph(note, paragraph);
+    if (note == null) {
+      // It is possible the note is removed, but the job is still running
+      LOG.warn("Note {} doesn't existed, it maybe deleted.", noteId);
+    } else {
+      note.clearParagraphOutput(paragraphId);
+      Paragraph paragraph = note.getParagraph(paragraphId);
+      broadcastParagraph(note, paragraph);
+    }
   }
 
   /**
@@ -1808,7 +1812,12 @@ public class NotebookServer extends WebSocketServlet
       }
 
       try {
-        getNotebook().saveNote(p.getNote(), p.getAuthenticationInfo());
+        if (getNotebook().getNote(p.getNote().getId()) == null) {
+          // It is possible the note is removed, but the job is still running
+          LOG.warn("Note {} doesn't existed.", p.getNote().getId());
+        } else {
+          getNotebook().saveNote(p.getNote(), p.getAuthenticationInfo());
+        }
       } catch (IOException e) {
         LOG.error(e.toString(), e);
       }
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/cluster/ZeppelinServerMock.java
b/zeppelin-server/src/test/java/org/apache/zeppelin/cluster/ZeppelinServerMock.java
index 9d1c893..4614dc4 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/cluster/ZeppelinServerMock.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/cluster/ZeppelinServerMock.java
@@ -174,6 +174,12 @@ public class ZeppelinServerMock {
       ZeppelinServer.jettyWebServer.stop();
       executor.shutdown();
       PluginManager.reset();
+      System.clearProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HOME.getVarName());
+      System.clearProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_WAR.getVarName());
+      System.clearProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_CONF_DIR.getVarName());
+      System.clearProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_CONFIG_FS_DIR.getVarName());
+      System.clearProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_GROUP_DEFAULT.getVarName());
+      System.clearProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName());
 
       long s = System.currentTimeMillis();
       boolean started = true;
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteManager.java
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteManager.java
index 4b6ba48..5ac3633 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteManager.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/NoteManager.java
@@ -53,6 +53,7 @@ public class NoteManager {
   private Folder trash;
 
   private NotebookRepo notebookRepo;
+  // noteId -> notePath
   private Map<String, String> notesInfo;
 
   public NoteManager(NotebookRepo notebookRepo) throws IOException {


Mime
View raw message