mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-4234. Python test is missing in travis
This commit is contained in:
parent
a8e7b96175
commit
42d6877aa7
6 changed files with 31 additions and 19 deletions
|
|
@ -111,17 +111,17 @@ matrix:
|
|||
dist: trusty
|
||||
env: BUILD_PLUGINS="true" PYTHON="2" SCALA_VER="2.12" PROFILE="-Pspark-2.4 -Pspark-scala-2.12 -Phadoop2 -Pintegration" SPARKR="true" BUILD_FLAG="install -DskipTests -DskipRat -am" TEST_FLAG="test -DskipRat -am" MODULES="-pl zeppelin-interpreter-integration,jdbc,zeppelin-web,spark/spark-dependencies" TEST_PROJECTS="-Dtest=ZeppelinSparkClusterTest24,SparkIntegrationTest24,JdbcIntegrationTest,org.apache.zeppelin.spark.* -DfailIfNoTests=false"
|
||||
|
||||
# ZeppelinSparkClusterTest23, SparkIntegrationTest23, Unit test of Spark 2.3 (Scala-2.11)
|
||||
# ZeppelinSparkClusterTest23, SparkIntegrationTest23, Unit test of Spark 2.3 (Scala-2.11) and Unit test PythonInterpreter under python2
|
||||
- sudo: required
|
||||
jdk: "oraclejdk8"
|
||||
dist: trusty
|
||||
env: BUILD_PLUGINS="true" PYTHON="2" SCALA_VER="2.11" PROFILE="-Pspark-2.3 -Pspark-scala-2.11 -Phadoop2 -Pintegration" SPARKR="true" BUILD_FLAG="install -DskipTests -DskipRat -am" TEST_FLAG="test -DskipRat -am" MODULES="-pl zeppelin-interpreter-integration,zeppelin-web,spark/spark-dependencies" TEST_PROJECTS="-Dtest=ZeppelinSparkClusterTest23,SparkIntegrationTest23,org.apache.zeppelin.spark.* -DfailIfNoTests=false"
|
||||
env: BUILD_PLUGINS="true" PYTHON="2" SCALA_VER="2.11" PROFILE="-Pspark-2.3 -Pspark-scala-2.11 -Phadoop2 -Pintegration" SPARKR="true" BUILD_FLAG="install -DskipTests -DskipRat -am" TEST_FLAG="test -DskipRat -am" MODULES="-pl zeppelin-interpreter-integration,zeppelin-web,spark/spark-dependencies" TEST_PROJECTS="-Dtest=ZeppelinSparkClusterTest23,SparkIntegrationTest23,org.apache.zeppelin.spark.*,apache.zeppelin.python.* -DfailIfNoTests=false"
|
||||
|
||||
# ZeppelinSparkClusterTest22, SparkIntegrationTest22, Unit test of Spark 2.2 (Scala-2.10)
|
||||
# ZeppelinSparkClusterTest22, SparkIntegrationTest22, Unit test of Spark 2.2 (Scala-2.10) and Unit test PythonInterpreter under python3
|
||||
- sudo: required
|
||||
jdk: "oraclejdk8"
|
||||
dist: trusty
|
||||
env: BUILD_PLUGINS="true" PYTHON="3" SCALA_VER="2.10" PROFILE="-Pspark-2.2 -Pspark-scala-2.10 -Phadoop2 -Pintegration" SPARKR="true" BUILD_FLAG="install -DskipTests -DskipRat -am" TEST_FLAG="test -DskipRat -am" MODULES="-pl zeppelin-interpreter-integration,zeppelin-web,spark/spark-dependencies" TEST_PROJECTS="-Dtest=ZeppelinSparkClusterTest22,SparkIntegrationTest22,org.apache.zeppelin.spark.* -DfailIfNoTests=false"
|
||||
env: BUILD_PLUGINS="true" PYTHON="3" SCALA_VER="2.10" PROFILE="-Pspark-2.2 -Pspark-scala-2.10 -Phadoop2 -Pintegration" SPARKR="true" BUILD_FLAG="install -DskipTests -DskipRat -am" TEST_FLAG="test -DskipRat -am" MODULES="-pl zeppelin-interpreter-integration,zeppelin-web,spark/spark-dependencies" TEST_PROJECTS="-Dtest=ZeppelinSparkClusterTest22,SparkIntegrationTest22,org.apache.zeppelin.spark.*,apache.zeppelin.python.* -DfailIfNoTests=false"
|
||||
|
||||
# ZeppelinSparkClusterTest21, SparkIntegrationTest21, Unit test of Spark 2.1 (Scala-2.10)
|
||||
- sudo: required
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ public class IPythonInterpreter extends Interpreter {
|
|||
.setCode(StringUtils.join(lines, System.lineSeparator())
|
||||
.replace("${JVM_GATEWAY_PORT}", jvmGatewayPort + "")
|
||||
.replace("${JVM_GATEWAY_ADDRESS}", serverAddress)).build());
|
||||
if (response.getStatus() == ExecuteStatus.ERROR) {
|
||||
if (response.getStatus() != ExecuteStatus.SUCCESS) {
|
||||
throw new IOException("Fail to setup JVMGateway\n" + response.getOutput());
|
||||
}
|
||||
|
||||
|
|
@ -223,14 +223,14 @@ public class IPythonInterpreter extends Interpreter {
|
|||
lines = IOUtils.readLines(input);
|
||||
response = ipythonClient.block_execute(ExecuteRequest.newBuilder()
|
||||
.setCode(StringUtils.join(lines, System.lineSeparator())).build());
|
||||
if (response.getStatus() == ExecuteStatus.ERROR) {
|
||||
if (response.getStatus() != ExecuteStatus.SUCCESS) {
|
||||
throw new IOException("Fail to import ZeppelinContext\n" + response.getOutput());
|
||||
}
|
||||
|
||||
response = ipythonClient.block_execute(ExecuteRequest.newBuilder()
|
||||
.setCode("z = __zeppelin__ = PyZeppelinContext(intp.getZeppelinContext(), gateway)")
|
||||
.build());
|
||||
if (response.getStatus() == ExecuteStatus.ERROR) {
|
||||
if (response.getStatus() != ExecuteStatus.SUCCESS) {
|
||||
throw new IOException("Fail to setup ZeppelinContext\n" + response.getOutput());
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ public class IPythonInterpreter extends Interpreter {
|
|||
.setCode(StringUtils.join(lines, System.lineSeparator())
|
||||
.replace("${JVM_GATEWAY_PORT}", jvmGatewayPort + "")
|
||||
.replace("${JVM_GATEWAY_ADDRESS}", serverAddress)).build());
|
||||
if (response.getStatus() == ExecuteStatus.ERROR) {
|
||||
if (response.getStatus() != ExecuteStatus.SUCCESS) {
|
||||
throw new IOException("Fail to run additional Python init file: "
|
||||
+ additionalPythonInitFile + "\n" + response.getOutput());
|
||||
}
|
||||
|
|
@ -390,7 +390,7 @@ public class IPythonInterpreter extends Interpreter {
|
|||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
LOGGER.debug("Call completion for: " + buf);
|
||||
LOGGER.debug("Call completion for: " + buf + ", cursor: " + cursor);
|
||||
List<InterpreterCompletion> completions = new ArrayList<>();
|
||||
CompletionResponse response =
|
||||
ipythonClient.complete(
|
||||
|
|
@ -402,6 +402,7 @@ public class IPythonInterpreter extends Interpreter {
|
|||
if (lastIndexOfDot != -1) {
|
||||
match = match.substring(lastIndexOfDot + 1);
|
||||
}
|
||||
LOGGER.debug("Candidate completion: " + match);
|
||||
completions.add(new InterpreterCompletion(match, match, ""));
|
||||
}
|
||||
return completions;
|
||||
|
|
|
|||
|
|
@ -206,15 +206,9 @@ public abstract class BasePythonInterpreterTest extends ConcurrentTestCase {
|
|||
|
||||
@Test
|
||||
public void testCodeCompletion() throws InterpreterException, IOException, InterruptedException {
|
||||
// there's no completion for 'a.' because it is not recognized by compiler for now.
|
||||
InterpreterContext context = getInterpreterContext();
|
||||
String st = "a='hello'\na.";
|
||||
List<InterpreterCompletion> completions = interpreter.completion(st, st.length(), context);
|
||||
assertEquals(0, completions.size());
|
||||
|
||||
// define `a` first
|
||||
context = getInterpreterContext();
|
||||
st = "a='hello'";
|
||||
InterpreterContext context = getInterpreterContext();
|
||||
String st = "a='hello'";
|
||||
InterpreterResult result = interpreter.interpret(st, context);
|
||||
Thread.sleep(100);
|
||||
assertEquals(InterpreterResult.Code.SUCCESS, result.code());
|
||||
|
|
@ -222,7 +216,7 @@ public abstract class BasePythonInterpreterTest extends ConcurrentTestCase {
|
|||
// now we can get the completion for `a.`
|
||||
context = getInterpreterContext();
|
||||
st = "a.";
|
||||
completions = interpreter.completion(st, st.length(), context);
|
||||
List<InterpreterCompletion> completions = interpreter.completion(st, st.length(), context);
|
||||
// it is different for python2 and python3 and may even different for different minor version
|
||||
// so only verify it is larger than 20
|
||||
assertTrue(completions.size() > 20);
|
||||
|
|
|
|||
|
|
@ -70,6 +70,20 @@ public class IPythonInterpreterTest extends BasePythonInterpreterTest {
|
|||
intpGroup.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testCodeCompletion() throws InterpreterException, IOException, InterruptedException {
|
||||
// only ipython can do this kind of code completion. native Python don't support this,
|
||||
// it requires you define a variable first in another interpret method.
|
||||
// TODO(zjffdu) enable after we upgrade miniconda
|
||||
// InterpreterContext context = getInterpreterContext();
|
||||
// String st = "a='hello'\na.";
|
||||
// List<InterpreterCompletion> completions = interpreter.completion(st, st.length(),
|
||||
// context);
|
||||
// assertTrue(completions.size() > 0);
|
||||
|
||||
super.testCodeCompletion();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIpythonKernelCrash_shouldNotHangExecution()
|
||||
throws InterpreterException, IOException {
|
||||
|
|
|
|||
|
|
@ -24,4 +24,6 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
|||
log4j.appender.stdout.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
|
||||
|
||||
|
||||
log4j.logger.org.apache.zeppelin.python=INFO
|
||||
log4j.logger.org.apache.zeppelin.python=DEBUG
|
||||
log4j.logger.org.apache.zeppelin.interpreter.util=DEBUG
|
||||
|
||||
|
|
|
|||
|
|
@ -47,5 +47,6 @@ log4j.logger.org.apache.zeppelin.interpreter=WARN
|
|||
log4j.logger.org.apache.zeppelin.spark=DEBUG
|
||||
|
||||
log4j.logger.org.apache.zeppelin.python=DEBUG
|
||||
log4j.logger.org.apache.zeppelin.interpreter.util=DEBUG
|
||||
log4j.logger.org.apache.spark.repl.Main=WARN
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue