Skip to content

Commit fbf0270

Browse files
committed
Fix z.run()
1 parent 21f65da commit fbf0270

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public class RemoteInterpreter extends Interpreter {
5757
static Map<String, RemoteInterpreterProcess> interpreterGroupReference
5858
= new HashMap<String, RemoteInterpreterProcess>();
5959

60-
private InterpreterContextRunnerPool interpreterContextRunnerPool;
6160
private int connectTimeout;
6261

6362
public RemoteInterpreter(Properties property,
@@ -72,7 +71,6 @@ public RemoteInterpreter(Properties property,
7271
this.interpreterRunner = interpreterRunner;
7372
this.interpreterPath = interpreterPath;
7473
env = new HashMap<String, String>();
75-
interpreterContextRunnerPool = new InterpreterContextRunnerPool();
7674
this.connectTimeout = connectTimeout;
7775
}
7876

@@ -195,6 +193,9 @@ public InterpreterResult interpret(String st, InterpreterContext context) {
195193
throw new InterpreterException(e1);
196194
}
197195

196+
InterpreterContextRunnerPool interpreterContextRunnerPool = interpreterProcess
197+
.getInterpreterContextRunnerPool();
198+
198199
List<InterpreterContextRunner> runners = context.getRunners();
199200
if (runners != null && runners.size() != 0) {
200201
// assume all runners in this InterpreterContext have the same note id
@@ -338,7 +339,7 @@ public void setInterpreterGroup(InterpreterGroup interpreterGroup) {
338339
|| (!intpProcess.isRunning() && intpProcess.getPort() == -1)) {
339340
interpreterGroupReference.put(getInterpreterGroupKey(interpreterGroup),
340341
new RemoteInterpreterProcess(interpreterRunner,
341-
interpreterPath, env, interpreterContextRunnerPool, connectTimeout));
342+
interpreterPath, env, connectTimeout));
342343

343344
logger.info("setInterpreterGroup = "
344345
+ getInterpreterGroupKey(interpreterGroup) + " class=" + className

zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,19 @@ public class RemoteInterpreterProcess implements ExecuteResultHandler {
5555
public RemoteInterpreterProcess(String intpRunner,
5656
String intpDir,
5757
Map<String, String> env,
58-
InterpreterContextRunnerPool interpreterContextRunnerPool, int connectTimeout) {
59-
this(intpRunner, intpDir, env, interpreterContextRunnerPool,
60-
new RemoteInterpreterEventPoller(), connectTimeout);
58+
int connectTimeout) {
59+
this(intpRunner, intpDir, env, new RemoteInterpreterEventPoller(), connectTimeout);
6160
}
6261

6362
RemoteInterpreterProcess(String intpRunner,
6463
String intpDir,
6564
Map<String, String> env,
66-
InterpreterContextRunnerPool interpreterContextRunnerPool,
6765
RemoteInterpreterEventPoller remoteInterpreterEventPoller,
6866
int connectTimeout) {
6967
this.interpreterRunner = intpRunner;
7068
this.interpreterDir = intpDir;
7169
this.env = env;
72-
this.interpreterContextRunnerPool = interpreterContextRunnerPool;
70+
this.interpreterContextRunnerPool = new InterpreterContextRunnerPool();
7371
referenceCount = new AtomicInteger(0);
7472
this.remoteInterpreterEventPoller = remoteInterpreterEventPoller;
7573
this.connectTimeout = connectTimeout;

zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ public class RemoteInterpreterProcessTest {
3232
@Test
3333
public void testStartStop() {
3434
InterpreterGroup intpGroup = new InterpreterGroup();
35-
RemoteInterpreterProcess rip = new RemoteInterpreterProcess("../bin/interpreter.sh", "nonexists", new HashMap<String, String>(),
36-
new InterpreterContextRunnerPool(), 10 * 1000);
35+
RemoteInterpreterProcess rip = new RemoteInterpreterProcess(
36+
"../bin/interpreter.sh", "nonexists", new HashMap<String, String>(),
37+
10 * 1000);
3738
assertFalse(rip.isRunning());
3839
assertEquals(0, rip.referenceCount());
3940
assertEquals(1, rip.reference(intpGroup));
@@ -48,8 +49,9 @@ public void testStartStop() {
4849
@Test
4950
public void testClientFactory() throws Exception {
5051
InterpreterGroup intpGroup = new InterpreterGroup();
51-
RemoteInterpreterProcess rip = new RemoteInterpreterProcess("../bin/interpreter.sh", "nonexists", new HashMap<String, String>(),
52-
new InterpreterContextRunnerPool(), mock(RemoteInterpreterEventPoller.class), 10 * 1000);
52+
RemoteInterpreterProcess rip = new RemoteInterpreterProcess(
53+
"../bin/interpreter.sh", "nonexists", new HashMap<String, String>(),
54+
mock(RemoteInterpreterEventPoller.class), 10 * 1000);
5355
rip.reference(intpGroup);
5456
assertEquals(0, rip.getNumActiveClient());
5557
assertEquals(0, rip.getNumIdleClient());

0 commit comments

Comments
 (0)