diff --git a/zeppelin-interpreter/pom.xml b/zeppelin-interpreter/pom.xml
index 67b4d5fbc9a..da1f8d023ef 100644
--- a/zeppelin-interpreter/pom.xml
+++ b/zeppelin-interpreter/pom.xml
@@ -214,8 +214,18 @@
+
+ org.apache.commons
+ commons-vfs2
+ 2.0
+
+
+ plexus-utils
+ org.codehaus.plexus
+
+
+
-
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java
index 6e369c0694a..b19fd9cd09e 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java
@@ -134,17 +134,47 @@ public static void main(String[] args)
System.exit(0);
}
+ private DistributedResourcePool getResourcePool()
+ /* InterpreterGroup group,
+ Properties prop,
+ RemoteInterpreterEventClient client) */
+ throws TException {
+ if (resourcePool != null)
+ return resourcePool;
+ try {
+ Properties prop = interpreterGroup.getProperty();
+ //Happens during tests.
+ if (prop == null)
+ prop = new Properties();
+ String resourcePoolClassName = (String) prop.getProperty(
+ "zeppelin.interpreter.resourcePoolClass");
+ logger.debug("Getting resource pool {}", resourcePoolClassName);
+ Class resourcePoolClass = Class.forName(resourcePoolClassName);
+
+ Constructor constructor = resourcePoolClass
+ .getConstructor(new Class[] {String.class,
+ ResourcePoolConnector.class,
+ Properties.class });
+ resourcePool = (DistributedResourcePool) constructor.newInstance(interpreterGroup.getId(),
+ this.eventClient,
+ prop);
+ interpreterGroup.setResourcePool(resourcePool);
+ return resourcePool;
+ } catch (Exception e) {
+ logger.error(e.toString(), e);
+ return new DistributedResourcePool(interpreterGroup.getId(), this.eventClient);
+ // throw new TException(e);
+ }
+ }
@Override
public void createInterpreter(String interpreterGroupId, String noteId, String
className,
- Map properties) throws TException {
+ Map properties) throws TException {
if (interpreterGroup == null) {
interpreterGroup = new InterpreterGroup(interpreterGroupId);
angularObjectRegistry = new AngularObjectRegistry(interpreterGroup.getId(), this);
- resourcePool = new DistributedResourcePool(interpreterGroup.getId(), eventClient);
interpreterGroup.setAngularObjectRegistry(angularObjectRegistry);
- interpreterGroup.setResourcePool(resourcePool);
}
try {
@@ -170,7 +200,12 @@ public void createInterpreter(String interpreterGroupId, String noteId, String
}
logger.info("Instantiate interpreter {}", className);
+
+ interpreterGroup.setResourcePool(getResourcePool());
+
repl.setInterpreterGroup(interpreterGroup);
+
+ //setResourcePool(interpreterGroup, p, eventClient);
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException
| InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException e) {
@@ -178,7 +213,6 @@ public void createInterpreter(String interpreterGroupId, String noteId, String
throw new TException(e);
}
}
-
private Interpreter getInterpreter(String noteId, String className) throws TException {
if (interpreterGroup == null) {
throw new TException(
@@ -353,11 +387,13 @@ protected Object jobRun() throws Throwable {
}
// put result into resource pool
- context.getResourcePool().put(
- context.getNoteId(),
- context.getParagraphId(),
- WellKnownResourceName.ParagraphResult.toString(),
- combinedResult);
+ if (context.getResourcePool() != null) {
+ context.getResourcePool().put(
+ context.getNoteId(),
+ context.getParagraphId(),
+ WellKnownResourceName.ParagraphResult.toString(),
+ combinedResult);
+ }
return combinedResult;
} finally {
InterpreterContext.remove();
@@ -388,7 +424,7 @@ public void cancel(String noteId, String className, RemoteInterpreterContext int
@Override
public int getProgress(String noteId, String className,
- RemoteInterpreterContext interpreterContext)
+ RemoteInterpreterContext interpreterContext)
throws TException {
Interpreter intp = getInterpreter(noteId, className);
return intp.getProgress(convert(interpreterContext));
@@ -411,7 +447,7 @@ public List completion(String noteId, String className, String buf, int
private InterpreterContext convert(RemoteInterpreterContext ric) {
List contextRunners = new LinkedList();
List runners = gson.fromJson(ric.getRunners(),
- new TypeToken>() {
+ new TypeToken>() {
}.getType());
for (InterpreterContextRunner r : runners) {
@@ -572,7 +608,7 @@ public void angularObjectUpdate(String name, String noteId, String paragraphId,
if (value == null) {
try {
value = gson.fromJson(object,
- new TypeToken