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-2990. Matplotlib sometimes fails in IPythonInterpreter
Date Mon, 16 Oct 2017 05:14:44 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/master 791619d61 -> 152538b7e


ZEPPELIN-2990. Matplotlib sometimes fails in IPythonInterpreter

### What is this PR for?
Trivial fix for matplotlib fail in `IPythonInterpreter`. Besides that, I also make some minor
changes on zeppelin code to improve logging.

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

### Todos
* [ ] - Task

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

### How should this be tested?
UT is added.

### 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 #2622 from zjffdu/ZEPPELIN-2990 and squashes the following commits:

55e6f88 [Jeff Zhang] fix unit test
1e57afe [Jeff Zhang] ZEPPELIN-2990. Matplotlib sometimes fails in IPythonInterpreter


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

Branch: refs/heads/master
Commit: 152538b7efc22e2c4c449f9fec4e524d92f8653c
Parents: 791619d
Author: Jeff Zhang <zjffdu@apache.org>
Authored: Mon Oct 16 11:28:23 2017 +0800
Committer: Jeff Zhang <zjffdu@apache.org>
Committed: Mon Oct 16 13:14:39 2017 +0800

----------------------------------------------------------------------
 interpreter-parent/pom.xml                              |  8 ++++++++
 .../java/org/apache/zeppelin/python/IPythonClient.java  |  2 +-
 .../org/apache/zeppelin/python/IPythonInterpreter.java  |  1 +
 .../apache/zeppelin/python/IPythonInterpreterTest.java  | 12 ++++++++++++
 .../apache/zeppelin/spark/IPySparkInterpreterTest.java  |  4 ++--
 .../java/org/apache/zeppelin/socket/NotebookServer.java |  2 +-
 .../remote/RemoteInterpreterEventPoller.java            |  1 -
 7 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/152538b7/interpreter-parent/pom.xml
----------------------------------------------------------------------
diff --git a/interpreter-parent/pom.xml b/interpreter-parent/pom.xml
index 32bdc57..cb08965 100644
--- a/interpreter-parent/pom.xml
+++ b/interpreter-parent/pom.xml
@@ -79,6 +79,14 @@
           <artifactId>maven-dependency-plugin</artifactId>
           <executions>
             <execution>
+              <id>copy-dependencies</id>
+              <phase>none</phase>
+              <configuration>
+                <skip>true</skip>
+              </configuration>
+            </execution>
+
+            <execution>
               <id>copy-interpreter-dependencies</id>
               <phase>package</phase>
               <goals>

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/152538b7/python/src/main/java/org/apache/zeppelin/python/IPythonClient.java
----------------------------------------------------------------------
diff --git a/python/src/main/java/org/apache/zeppelin/python/IPythonClient.java b/python/src/main/java/org/apache/zeppelin/python/IPythonClient.java
index 05fe4ba..ac10204 100644
--- a/python/src/main/java/org/apache/zeppelin/python/IPythonClient.java
+++ b/python/src/main/java/org/apache/zeppelin/python/IPythonClient.java
@@ -96,7 +96,7 @@ public class IPythonClient {
             LOGGER.debug("Interpreter Streaming Output: " + executeResponse.getOutput());
             if (isPreviousOutputImage) {
               // add '\n' when switch from image to text
-              interpreterOutput.write("\n".getBytes());
+              interpreterOutput.write("\n%text ".getBytes());
             }
             isPreviousOutputImage = false;
             interpreterOutput.write(executeResponse.getOutput().getBytes());

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/152538b7/python/src/main/java/org/apache/zeppelin/python/IPythonInterpreter.java
----------------------------------------------------------------------
diff --git a/python/src/main/java/org/apache/zeppelin/python/IPythonInterpreter.java b/python/src/main/java/org/apache/zeppelin/python/IPythonInterpreter.java
index 1c2ced5..77e45b9 100644
--- a/python/src/main/java/org/apache/zeppelin/python/IPythonInterpreter.java
+++ b/python/src/main/java/org/apache/zeppelin/python/IPythonInterpreter.java
@@ -286,6 +286,7 @@ public class IPythonInterpreter extends Interpreter implements ExecuteResultHand
     } else {
       envs.put("PYTHONPATH", additionalPythonPath);
     }
+    LOGGER.info("PYTHONPATH:" + envs.get("PYTHONPATH"));
     return envs;
   }
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/152538b7/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java
----------------------------------------------------------------------
diff --git a/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java b/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java
index 6a388c2..104fe19 100644
--- a/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java
+++ b/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java
@@ -284,12 +284,24 @@ public class IPythonInterpreterTest {
     // the order of IMAGE and TEXT is not determined
     // check there must be one IMAGE output
     boolean hasImageOutput = false;
+    boolean hasLineText = false;
+    boolean hasFigureText = false;
     for (InterpreterResultMessage msg : interpreterResultMessages) {
       if (msg.getType() == InterpreterResult.Type.IMG) {
         hasImageOutput = true;
       }
+      if (msg.getType() == InterpreterResult.Type.TEXT
+          && msg.getData().contains("matplotlib.lines.Line2D")) {
+        hasLineText = true;
+      }
+      if (msg.getType() == InterpreterResult.Type.TEXT
+          && msg.getData().contains("matplotlib.figure.Figure")) {
+        hasFigureText = true;
+      }
     }
     assertTrue("No Image Output", hasImageOutput);
+    assertTrue("No Line Text", hasLineText);
+    assertTrue("No Figure Text", hasFigureText);
 
     // bokeh
     // bokeh initialization

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/152538b7/spark/src/test/java/org/apache/zeppelin/spark/IPySparkInterpreterTest.java
----------------------------------------------------------------------
diff --git a/spark/src/test/java/org/apache/zeppelin/spark/IPySparkInterpreterTest.java b/spark/src/test/java/org/apache/zeppelin/spark/IPySparkInterpreterTest.java
index faf0473..5f6d42c 100644
--- a/spark/src/test/java/org/apache/zeppelin/spark/IPySparkInterpreterTest.java
+++ b/spark/src/test/java/org/apache/zeppelin/spark/IPySparkInterpreterTest.java
@@ -146,7 +146,7 @@ public class IPySparkInterpreterTest {
         List<InterpreterResultMessage> interpreterResultMessages = null;
         try {
           interpreterResultMessages = context2.out.getInterpreterResultMessages();
-          assertTrue(interpreterResultMessages.get(0).getData().contains("cancelled"));
+          assertTrue(interpreterResultMessages.get(0).getData().contains("KeyboardInterrupt"));
         } catch (IOException e) {
           e.printStackTrace();
         }
@@ -180,7 +180,7 @@ public class IPySparkInterpreterTest {
         "ssc.start()\n" +
         "time.sleep(6)\n" +
         "ssc.stop(stopSparkContext=False, stopGraceFully=True)", context);
-    Thread.sleep(100);
+    Thread.sleep(1000);
     assertEquals(InterpreterResult.Code.SUCCESS, result.code());
     interpreterResultMessages = context.out.getInterpreterResultMessages();
     assertEquals(1, interpreterResultMessages.size());

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/152538b7/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 1e7b74f..8c13e21 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
@@ -357,7 +357,7 @@ public class NotebookServer extends WebSocketServlet
           break;
       }
     } catch (Exception e) {
-      LOG.error("Can't handle message", e);
+      LOG.error("Can't handle message: " + msg, e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/152538b7/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
index 35b6b6c..abda81e 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventPoller.java
@@ -246,7 +246,6 @@ public class RemoteInterpreterEventPoller extends Thread {
             listener.onParaInfosReceived(noteId, paraId, settingId, paraInfos);
           }
         }
-        logger.debug("Event from remote process {}", event.getType());
       } catch (Exception e) {
         logger.error("Can't handle event " + event, e);
       }


Mime
View raw message