This is an automated email from the ASF dual-hosted git repository. pdallig pushed a commit to branch recover_interpretergroup in repository https://gitbox.apache.org/repos/asf/zeppelin.git
commit 66064de17102f378261c3b6f90c257f735f7e887 Author: Philipp Dallig <philipp.dal...@gmail.com> AuthorDate: Thu Oct 21 15:56:13 2021 +0200 Restart interpreter process if not running --- .../org/apache/zeppelin/interpreter/ManagedInterpreterGroup.java | 7 +++++++ .../org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/ManagedInterpreterGroup.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/ManagedInterpreterGroup.java index fb17542..af7e7e8 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/ManagedInterpreterGroup.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/ManagedInterpreterGroup.java @@ -61,6 +61,12 @@ public class ManagedInterpreterGroup extends InterpreterGroup { Properties properties) throws IOException { synchronized (interpreterProcessCreationLock) { + // Stop the interpreterProcess to cleanup the state if not running + if (remoteInterpreterProcess != null && !remoteInterpreterProcess.isRunning()) { + LOGGER.info("InterpreterProcess for InterpreterGroup {} is not running. Stop the interpreter process to clean up the state. Error message: {}", getId(), remoteInterpreterProcess.getErrorMessage()); + remoteInterpreterProcess.stop(); + remoteInterpreterProcess = null; + } if (remoteInterpreterProcess == null) { LOGGER.info("Create InterpreterProcess for InterpreterGroup: {}", getId()); remoteInterpreterProcess = interpreterSetting.createInterpreterProcess(id, userName, @@ -183,6 +189,7 @@ public class ManagedInterpreterGroup extends InterpreterGroup { } } + @Override public boolean isEmpty() { return this.sessions.isEmpty(); } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java index 16e47c3..439bf0b 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java @@ -96,7 +96,7 @@ public class RemoteInterpreter extends Interpreter { } public synchronized RemoteInterpreterProcess getOrCreateInterpreterProcess() throws IOException { - if (this.interpreterProcess != null) { + if (this.interpreterProcess != null && this.interpreterProcess.isRunning()) { return this.interpreterProcess; } ManagedInterpreterGroup intpGroup = getInterpreterGroup(); @@ -125,9 +125,9 @@ public class RemoteInterpreter extends Interpreter { ((RemoteInterpreter) interpreter).internal_create(); } } catch (IOException e) { - LOGGER.error("Interpreter creation failed", e); - interpreterProcess = null; - getInterpreterGroup().close(sessionId); +// LOGGER.error("Interpreter creation failed", e); +// interpreterProcess = null; +// getInterpreterGroup().close(sessionId); throw new InterpreterException(e); } }