You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2015/06/28 05:45:11 UTC
incubator-zeppelin git commit: ZEPPELIN-135 z.run() is raising
exception
Repository: incubator-zeppelin
Updated Branches:
refs/heads/master 1bc5e8df9 -> 052524956
ZEPPELIN-135 z.run() is raising exception
This PR fixes https://issues.apache.org/jira/browse/ZEPPELIN-135
Test included.
Author: Lee moon soo <mo...@apache.org>
Closes #124 from Leemoonsoo/fix_zrun and squashes the following commits:
fbf0270 [Lee moon soo] Fix z.run()
21f65da [Lee moon soo] Add a test for z.run()
Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/05252495
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/05252495
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/05252495
Branch: refs/heads/master
Commit: 052524956357a1d6c616bf0c7bfa2bf805d30daf
Parents: 1bc5e8d
Author: Lee moon soo <mo...@apache.org>
Authored: Fri Jun 26 13:37:17 2015 -0700
Committer: Lee moon soo <mo...@apache.org>
Committed: Sat Jun 27 20:45:04 2015 -0700
----------------------------------------------------------------------
.../interpreter/remote/RemoteInterpreter.java | 7 ++++---
.../remote/RemoteInterpreterProcess.java | 8 +++-----
.../remote/RemoteInterpreterProcessTest.java | 10 ++++++----
.../zeppelin/rest/ZeppelinSparkClusterTest.java | 21 ++++++++++++++++++++
4 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/05252495/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java
index 22818fc..cd77dc4 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java
@@ -57,7 +57,6 @@ public class RemoteInterpreter extends Interpreter {
static Map<String, RemoteInterpreterProcess> interpreterGroupReference
= new HashMap<String, RemoteInterpreterProcess>();
- private InterpreterContextRunnerPool interpreterContextRunnerPool;
private int connectTimeout;
public RemoteInterpreter(Properties property,
@@ -72,7 +71,6 @@ public class RemoteInterpreter extends Interpreter {
this.interpreterRunner = interpreterRunner;
this.interpreterPath = interpreterPath;
env = new HashMap<String, String>();
- interpreterContextRunnerPool = new InterpreterContextRunnerPool();
this.connectTimeout = connectTimeout;
}
@@ -195,6 +193,9 @@ public class RemoteInterpreter extends Interpreter {
throw new InterpreterException(e1);
}
+ InterpreterContextRunnerPool interpreterContextRunnerPool = interpreterProcess
+ .getInterpreterContextRunnerPool();
+
List<InterpreterContextRunner> runners = context.getRunners();
if (runners != null && runners.size() != 0) {
// assume all runners in this InterpreterContext have the same note id
@@ -338,7 +339,7 @@ public class RemoteInterpreter extends Interpreter {
|| (!intpProcess.isRunning() && intpProcess.getPort() == -1)) {
interpreterGroupReference.put(getInterpreterGroupKey(interpreterGroup),
new RemoteInterpreterProcess(interpreterRunner,
- interpreterPath, env, interpreterContextRunnerPool, connectTimeout));
+ interpreterPath, env, connectTimeout));
logger.info("setInterpreterGroup = "
+ getInterpreterGroupKey(interpreterGroup) + " class=" + className
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/05252495/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java
index 5dd2a65..f917eb9 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcess.java
@@ -55,21 +55,19 @@ public class RemoteInterpreterProcess implements ExecuteResultHandler {
public RemoteInterpreterProcess(String intpRunner,
String intpDir,
Map<String, String> env,
- InterpreterContextRunnerPool interpreterContextRunnerPool, int connectTimeout) {
- this(intpRunner, intpDir, env, interpreterContextRunnerPool,
- new RemoteInterpreterEventPoller(), connectTimeout);
+ int connectTimeout) {
+ this(intpRunner, intpDir, env, new RemoteInterpreterEventPoller(), connectTimeout);
}
RemoteInterpreterProcess(String intpRunner,
String intpDir,
Map<String, String> env,
- InterpreterContextRunnerPool interpreterContextRunnerPool,
RemoteInterpreterEventPoller remoteInterpreterEventPoller,
int connectTimeout) {
this.interpreterRunner = intpRunner;
this.interpreterDir = intpDir;
this.env = env;
- this.interpreterContextRunnerPool = interpreterContextRunnerPool;
+ this.interpreterContextRunnerPool = new InterpreterContextRunnerPool();
referenceCount = new AtomicInteger(0);
this.remoteInterpreterEventPoller = remoteInterpreterEventPoller;
this.connectTimeout = connectTimeout;
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/05252495/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java
index 0043272..ea5397e 100644
--- a/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java
+++ b/zeppelin-interpreter/src/test/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterProcessTest.java
@@ -32,8 +32,9 @@ public class RemoteInterpreterProcessTest {
@Test
public void testStartStop() {
InterpreterGroup intpGroup = new InterpreterGroup();
- RemoteInterpreterProcess rip = new RemoteInterpreterProcess("../bin/interpreter.sh", "nonexists", new HashMap<String, String>(),
- new InterpreterContextRunnerPool(), 10 * 1000);
+ RemoteInterpreterProcess rip = new RemoteInterpreterProcess(
+ "../bin/interpreter.sh", "nonexists", new HashMap<String, String>(),
+ 10 * 1000);
assertFalse(rip.isRunning());
assertEquals(0, rip.referenceCount());
assertEquals(1, rip.reference(intpGroup));
@@ -48,8 +49,9 @@ public class RemoteInterpreterProcessTest {
@Test
public void testClientFactory() throws Exception {
InterpreterGroup intpGroup = new InterpreterGroup();
- RemoteInterpreterProcess rip = new RemoteInterpreterProcess("../bin/interpreter.sh", "nonexists", new HashMap<String, String>(),
- new InterpreterContextRunnerPool(), mock(RemoteInterpreterEventPoller.class), 10 * 1000);
+ RemoteInterpreterProcess rip = new RemoteInterpreterProcess(
+ "../bin/interpreter.sh", "nonexists", new HashMap<String, String>(),
+ mock(RemoteInterpreterEventPoller.class), 10 * 1000);
rip.reference(intpGroup);
assertEquals(0, rip.getNumActiveClient());
assertEquals(0, rip.getNumIdleClient());
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/05252495/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java
index 02b7e47..758a1e4 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinSparkClusterTest.java
@@ -89,6 +89,27 @@ public class ZeppelinSparkClusterTest extends AbstractTestRestApi {
ZeppelinServer.notebook.removeNote(note.id());
}
+ @Test
+ public void zRunTest() throws IOException {
+ // create new note
+ Note note = ZeppelinServer.notebook.createNote();
+ Paragraph p0 = note.addParagraph();
+ p0.setText("z.run(1)");
+ Paragraph p1 = note.addParagraph();
+ p1.setText("val a=10");
+ Paragraph p2 = note.addParagraph();
+ p2.setText("print(a)");
+
+ note.run(p0.getId());
+ waitForFinish(p0);
+
+ note.run(p2.getId());
+ waitForFinish(p2);
+ assertEquals("10", p2.getResult().message());
+
+ ZeppelinServer.notebook.removeNote(note.id());
+ }
+
/**
* Get spark version number as a numerical value.
* eg. 1.1.x => 11, 1.2.x => 12, 1.3.x => 13 ...