liuxunorg commented on a change in pull request #3342: [ZEPPELIN-4031] Fixed 
Unable to detect that the interpreter process was killed manually
URL: https://github.com/apache/zeppelin/pull/3342#discussion_r269836270
 
 

 ##########
 File path: 
zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java
 ##########
 @@ -199,13 +199,31 @@ public Void call(Client client) throws Exception {
     }
   }
 
+  // Detecting an invalid interpreter process,
+  // Clean up session, Recreate the interpreter process
+  private void resurrectionInvalidIntpProcess() throws InterpreterException {
+    if (interpreterProcess != null && !interpreterProcess.isRunning() && 
isOpened) {
+      LOGGER.info("Check whether the InterpreterProcess has been shutdown.");
+      // clean invalid session and dirty data of interpreterSetting
+      ManagedInterpreterGroup intpGroup = getInterpreterGroup();
+      intpGroup.close();
+      // recreate RemoteInterpreterProcess
+      isOpened = false;
+      isCreated = false;
+      open();
+    }
+  }
+
   @Override
   public InterpreterResult interpret(final String st, final InterpreterContext 
context)
       throws InterpreterException {
     if (LOGGER.isDebugEnabled()) {
       LOGGER.debug("st:\n{}", st);
     }
 
+    // Detecting an invalid interpreter process
+    resurrectionInvalidIntpProcess();
 
 Review comment:
   Every time the user executes a note, Called
   `RemoteInterpreter.java::interpret(final String st, final InterpreterContext 
context)` function,
   Check if the remote interpreter process is valid, If the remote interpreter 
is invalid,
   In the `RemoteInterpreter.java`, It is very easy to perform session 
recycling for the interpreter process,
   And recreate the interpreter. Conforms to zeppelin's original process of 
creating an interpreter.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to