ZEPPELIN-804 Refactoring registration mechanism on Interpreters

- Removed a interpreter which fails to initialize
This commit is contained in:
Jongyoul Lee 2016-04-15 10:13:51 +09:00
parent d3436369a7
commit 0d720c02b7
2 changed files with 12 additions and 5 deletions

View file

@ -111,7 +111,7 @@
"description": "Python command to run pyspark with"
}
}
}/*, //
},
{
"interpreterGroup": "spark",
"interpreterName": "r",
@ -142,5 +142,5 @@
"description": ""
}
}
}*/
}
]

View file

@ -177,9 +177,10 @@ public class RemoteInterpreter extends Interpreter {
}
} catch (TException e) {
broken = true;
logger.error("Failed to create interpreter: {}", getClassName());
throw new InterpreterException(e);
} finally {
// TODO(jongyoul): Fixed it when not all of interpreter in same interpreter group are broken
interpreterProcess.releaseClient(client, broken);
}
}
@ -195,12 +196,18 @@ public class RemoteInterpreter extends Interpreter {
synchronized (interpreterGroup) {
// initialize all interpreters in this interpreter group
List<Interpreter> interpreters = interpreterGroup.get(noteId);
for (Interpreter intp : interpreters) {
for (Interpreter intp : new ArrayList<>(interpreters)) {
Interpreter p = intp;
while (p instanceof WrappedInterpreter) {
p = ((WrappedInterpreter) p).getInnerInterpreter();
}
((RemoteInterpreter) p).init();
try {
((RemoteInterpreter) p).init();
} catch (InterpreterException e) {
logger.error("Failed to initialize interpreter: {}. Remove it from interpreterGroup",
p.getClassName());
interpreters.remove(p);
}
}
}
}