mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-4062. Don't wait ipython kernel if python process failed
This commit is contained in:
parent
3c7f0093f4
commit
130c2a82a0
1 changed files with 6 additions and 1 deletions
|
|
@ -82,6 +82,7 @@ public class IPythonInterpreter extends Interpreter implements ExecuteResultHand
|
|||
private boolean useBuiltinPy4j = true;
|
||||
private boolean usePy4JAuth = true;
|
||||
private String secret;
|
||||
private volatile boolean pythonProcessFailed = false;
|
||||
|
||||
private InterpreterOutputStream interpreterOutput = new InterpreterOutputStream(LOGGER);
|
||||
|
||||
|
|
@ -293,7 +294,7 @@ public class IPythonInterpreter extends Interpreter implements ExecuteResultHand
|
|||
|
||||
// wait until IPython kernel is started or timeout
|
||||
long startTime = System.currentTimeMillis();
|
||||
while (true) {
|
||||
while (!pythonProcessFailed) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
@ -318,6 +319,9 @@ public class IPythonInterpreter extends Interpreter implements ExecuteResultHand
|
|||
+ " seconds");
|
||||
}
|
||||
}
|
||||
if (pythonProcessFailed) {
|
||||
throw new IOException("Fail to launch IPython Kernel as the python process is failed");
|
||||
}
|
||||
}
|
||||
|
||||
protected Map<String, String> setupIPythonEnv() throws IOException {
|
||||
|
|
@ -417,6 +421,7 @@ public class IPythonInterpreter extends Interpreter implements ExecuteResultHand
|
|||
@Override
|
||||
public void onProcessFailed(ExecuteException e) {
|
||||
LOGGER.warn("Exception happens in Python Process", e);
|
||||
pythonProcessFailed = true;
|
||||
}
|
||||
|
||||
static class ProcessLogOutputStream extends LogOutputStream {
|
||||
|
|
|
|||
Loading…
Reference in a new issue