You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by bz...@apache.org on 2016/11/09 06:32:34 UTC

zeppelin git commit: [ZEPPELIN-449] Enhance log messages when interpreter is initializing

Repository: zeppelin
Updated Branches:
  refs/heads/master e25266706 -> a4f9f6bad


[ZEPPELIN-449] Enhance log messages when interpreter is initializing

### What is this PR for?

Enhance log messages when interpreter is initializing to avoid user confusion.
### What type of PR is it?

[Bug Fix]
### What is the Jira issue?
- [ZEPPELIN-449](https://issues.apache.org/jira/browse/ZEPPELIN-449)

Author: Luciano Resende <lr...@apache.org>

Closes #1376 from lresende/zeppelin-449 and squashes the following commits:

1f75430 [Luciano Resende] [ZEPPELIN-449] Enhance log messages when intepreter is initializing


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

Branch: refs/heads/master
Commit: a4f9f6bad83251d5a0b839b5e73bbe44f7468569
Parents: e252667
Author: Luciano Resende <lr...@apache.org>
Authored: Sun Aug 28 18:06:59 2016 -0700
Committer: Alexander Bezzubov <bz...@apache.org>
Committed: Wed Nov 9 15:32:23 2016 +0900

----------------------------------------------------------------------
 .../remote/RemoteInterpreterManagedProcess.java | 22 +++++++++++++-------
 .../remote/RemoteInterpreterUtils.java          | 15 +++++++++++--
 2 files changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a4f9f6ba/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterManagedProcess.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterManagedProcess.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterManagedProcess.java
index eb34533..ddab105 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterManagedProcess.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterManagedProcess.java
@@ -124,14 +124,20 @@ public class RemoteInterpreterManagedProcess extends RemoteInterpreterProcess
 
     long startTime = System.currentTimeMillis();
     while (System.currentTimeMillis() - startTime < getConnectTimeout()) {
-      if (RemoteInterpreterUtils.checkIfRemoteEndpointAccessible("localhost", port)) {
-        break;
-      } else {
-        try {
-          Thread.sleep(500);
-        } catch (InterruptedException e) {
-          logger.error("Exception in RemoteInterpreterProcess while synchronized reference " +
-              "Thread.sleep", e);
+      try {
+        if (RemoteInterpreterUtils.checkIfRemoteEndpointAccessible("localhost", port)) {
+          break;
+        } else {
+          try {
+            Thread.sleep(500);
+          } catch (InterruptedException e) {
+            logger.error("Exception in RemoteInterpreterProcess while synchronized reference " +
+                    "Thread.sleep", e);
+          }
+        }
+      } catch (Exception e) {
+        if (logger.isDebugEnabled()) {
+          logger.debug("Remote interpreter not yet accessible at localhost:" + port);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a4f9f6ba/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java
index a66b52a..2937e2d 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java
@@ -21,6 +21,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
+import java.net.ConnectException;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
@@ -46,9 +47,19 @@ public class RemoteInterpreterUtils {
       discover.connect(new InetSocketAddress(host, port), 1000);
       discover.close();
       return true;
-    } catch (IOException e) {
+    } catch (ConnectException cne) {
       // end point is not accessible
-      LOGGER.debug(e.getMessage(), e);
+      if (LOGGER.isDebugEnabled()) {
+        LOGGER.debug("Remote endpoint '" + host + ":" + port + "' is not accessible " +
+                "(might be initializing): " + cne.getMessage());
+      }
+      return false;
+    } catch (IOException ioe) {
+      // end point is not accessible
+      if (LOGGER.isDebugEnabled()) {
+        LOGGER.debug("Remote endpoint '" + host + ":" + port + "' is not accessible " +
+                "(might be initializing): " + ioe.getMessage());
+      }
       return false;
     }
   }