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

liuxun 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 8be90b1  [ZEPPELIN-3065] Personalized mode does not allow multiple 
users to run the same paragraph at the same time
8be90b1 is described below

commit 8be90b1e4410a73d0df1232749396243966252f9
Author: shoaibintigral <[email protected]>
AuthorDate: Fri Jul 26 18:33:02 2019 +0500

    [ZEPPELIN-3065] Personalized mode does not allow multiple users to run the 
same paragraph at the same time
    
    ### What is this PR for?
    In personalized mode, if user A is running a paragraph and user B starts 
running the paragraph before user A's run has completed then user A's paragraph 
will remain stuck in the "running" state. Furthermore, all messages from user 
B's run be appended to the output for user A.
    
    ### What type of PR is it?
    Bug Fix
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-3065
    
    ### How should this be tested?
    * Simultaneously run same paragraph using two separate users in both 
personalized mode. Both users should get the results.
    CI passed:
    https://travis-ci.org/srehmann/zeppelin/builds/566330819
    ## 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: shoaibintigral <[email protected]>
    
    Closes #3413 from srehmann/ZP3065 and squashes the following commits:
    
    1e3b2318f [shoaibintigral] Bug Fix: ZEPPELIN-3065 Personalized mode does 
not allow multiple users to run the same paragraph at the same time
---
 .../org/apache/zeppelin/service/NotebookService.java     |  4 ++--
 .../src/main/java/org/apache/zeppelin/notebook/Note.java | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
 
b/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
index ccd6639..0567c4b 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
@@ -312,7 +312,7 @@ public class NotebookService {
     p.setConfig(config);
 
     if (note.isPersonalizedMode()) {
-      p = note.getParagraph(paragraphId);
+      p = p.getUserParagraph(context.getAutheInfo().getUser());
       p.setText(text);
       p.setTitle(title);
       p.setAuthenticationInfo(context.getAutheInfo());
@@ -322,7 +322,7 @@ public class NotebookService {
 
     try {
       notebook.saveNote(note, context.getAutheInfo());
-      boolean result = note.run(p.getId(), blocking);
+      boolean result = note.run(p.getId(), blocking, 
context.getAutheInfo().getUser());
       callback.onSuccess(p, context);
       return result;
     } catch (Exception ex) {
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
index b01b8c2..9c4138c 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
@@ -836,7 +836,23 @@ public class Note implements JsonSerializable {
    * @param paragraphId ID of paragraph
    */
   public boolean run(String paragraphId, boolean blocking) {
+    return run(paragraphId, blocking, null);
+  }
+
+  /**
+   * Run a single paragraph
+   *
+   * @param paragraphId
+   * @param blocking
+   * @param ctxUser
+   * @return
+   */
+  public boolean run(String paragraphId, boolean blocking, String ctxUser) {
     Paragraph p = getParagraph(paragraphId);
+
+    if (isPersonalizedMode() && ctxUser != null)
+      p = p.getUserParagraph(ctxUser);
+
     p.setListener(this.paragraphJobListener);
     return p.execute(blocking);
   }

Reply via email to