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-2421. AngularObject miss AngularObjectListener when it is pushed from frontend
Date Fri, 21 Apr 2017 03:05:12 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/master 7a0cb6c7a -> 09e8f7f0c


ZEPPELIN-2421. AngularObject miss AngularObjectListener when it is pushed from frontend

### What is this PR for?
This bug happens when you save your note, and restart zeppelin and run it again. The root
cause is that the angular object miss  AngularObjectListener which means you can not sync
up the changes on angular object to frontend. This PR would restore the listener correctly
when we restore the angular objects saved before.  Also make some changes for logging in this
PR.

### What type of PR is it?
[Bug Fix]

### Todos
* [ ] - Task

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-2421

### How should this be tested?
Tested manually

### Screenshots (if appropriate)

Before
![zeppelin_before](https://cloud.githubusercontent.com/assets/164491/25173268/0824dc72-2526-11e7-955c-ea5e20dae746.gif)

After
![zeppelin_after](https://cloud.githubusercontent.com/assets/164491/25173272/09e11bfc-2526-11e7-9096-5adb6f1992ef.gif)

### 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 #2263 from zjffdu/ZEPPELIn-2421 and squashes the following commits:

c2503a4 [Jeff Zhang] ZEPPELIN-2421. AngularObject miss AngularObjectListener when it is pushed
from frontend


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

Branch: refs/heads/master
Commit: 09e8f7f0cd84efd9c67fff44119f7953881d91ab
Parents: 7a0cb6c
Author: Jeff Zhang <zjffdu@apache.org>
Authored: Wed Apr 19 17:26:21 2017 +0800
Committer: Jeff Zhang <zjffdu@apache.org>
Committed: Fri Apr 21 11:05:04 2017 +0800

----------------------------------------------------------------------
 .../java/org/apache/zeppelin/display/AngularObjectRegistry.java | 5 +++++
 .../interpreter/remote/RemoteInterpreterEventClient.java        | 5 +++--
 .../interpreter/remote/RemoteInterpreterEventPoller.java        | 3 +++
 .../main/java/org/apache/zeppelin/socket/NotebookServer.java    | 4 ++--
 4 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/09e8f7f0/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java
b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java
index 6b2bfac..a993992 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java
@@ -252,5 +252,10 @@ public class AngularObjectRegistry {
 
   public void setRegistry(Map<String, Map<String, AngularObject>> registry) {
     this.registry = registry;
+    for (Map<String, AngularObject> map : registry.values()) {
+      for (AngularObject ao : map.values()) {
+        ao.setListener(angularObjectListener);
+      }
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/09e8f7f0/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
index 73c14f1..bb6de31 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java
@@ -46,7 +46,7 @@ import java.util.Map;
  * RemoteInterpreterEventPoller is counter part in ZeppelinServer
  */
 public class RemoteInterpreterEventClient implements ResourcePoolConnector {
-  private final Logger logger = LoggerFactory.getLogger(RemoteInterpreterEvent.class);
+  private final Logger logger = LoggerFactory.getLogger(RemoteInterpreterEventClient.class);
   private final List<RemoteInterpreterEvent> eventQueue = new LinkedList<>();
   private final List<ResourceSet> getAllResourceResponse = new LinkedList<>();
   private final Map<ResourceId, Object> getResourceResponse = new HashMap<>();
@@ -415,6 +415,7 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector
{
   }
 
   private void sendEvent(RemoteInterpreterEvent event) {
+    logger.debug("Send Event: " + event);
     synchronized (eventQueue) {
       eventQueue.add(event);
       eventQueue.notifyAll();
@@ -446,7 +447,7 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector
{
     appendOutput.put("appId", appId);
     appendOutput.put("type", type);
     appendOutput.put("data", output);
-    logger.info("onAppoutputUpdate = {}", output);
+    logger.debug("onAppoutputUpdate = {}", output);
     sendEvent(new RemoteInterpreterEvent(
         RemoteInterpreterEventType.OUTPUT_UPDATE,
         gson.toJson(appendOutput)));

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/09e8f7f0/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
index f46d31a..c841c71 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
@@ -124,6 +124,9 @@ public class RemoteInterpreterEventPoller extends Thread {
       AngularObjectRegistry angularObjectRegistry = interpreterGroup.getAngularObjectRegistry();
 
       try {
+        if (event.getType() != RemoteInterpreterEventType.NO_OP) {
+          logger.debug("Receive message from RemoteInterpreter Process: " + event.toString());
+        }
         if (event.getType() == RemoteInterpreterEventType.NO_OP) {
           continue;
         } else if (event.getType() == RemoteInterpreterEventType.ANGULAR_OBJECT_ADD) {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/09e8f7f0/zeppelin-server/src/main/java/org/apache/zeppelin/socket/NotebookServer.java
----------------------------------------------------------------------
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 a9f2995..4a0665b 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
@@ -494,7 +494,7 @@ public class NotebookServer extends WebSocketServlet
       if (socketLists == null || socketLists.size() == 0) {
         return;
       }
-      LOG.debug("SEND >> " + m.op);
+      LOG.debug("SEND >> " + m);
       for (NotebookSocket conn : socketLists) {
         try {
           conn.send(serializeMessage(m));
@@ -512,7 +512,7 @@ public class NotebookServer extends WebSocketServlet
       if (socketLists == null || socketLists.size() == 0) {
         return;
       }
-      LOG.debug("SEND >> " + m.op);
+      LOG.debug("SEND >> " + m);
       for (NotebookSocket conn : socketLists) {
         if (exclude.equals(conn)) {
           continue;


Mime
View raw message