From 5bed19496d64b00a04b4f522783bbba95b8133af Mon Sep 17 00:00:00 2001 From: marc hurabielle Date: Mon, 29 Apr 2019 21:36:58 +0900 Subject: [PATCH] fix lint --- .../resources/grpc/python/ipython_server.py | 4 +- .../python/IPythonInterpreterTest.java | 44 +++++++++---------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/python/src/main/resources/grpc/python/ipython_server.py b/python/src/main/resources/grpc/python/ipython_server.py index b1fcd69f51..47f67b7b6f 100644 --- a/python/src/main/resources/grpc/python/ipython_server.py +++ b/python/src/main/resources/grpc/python/ipython_server.py @@ -87,8 +87,8 @@ class IPython(ipython_pb2_grpc.IPythonServicer): payload_reply = [] def execute_worker(): reply = self._kc.execute_interactive(request.code, - output_hook=_output_hook, - timeout=None) + output_hook=_output_hook, + timeout=None) payload_reply.append(reply) t = threading.Thread(name="ConsumerThread", target=execute_worker) diff --git a/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java b/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java index 071956517d..fdb06cc0ce 100644 --- a/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java +++ b/python/src/test/java/org/apache/zeppelin/python/IPythonInterpreterTest.java @@ -301,33 +301,31 @@ public class IPythonInterpreterTest extends BasePythonInterpreterTest { // The goal of this test is to ensure that concurrent interpret and complete // will not make execute hang forever. - // ExecutorService pool = Executors.newFixedThreadPool(2); - // FutureTask interpretFuture = - // new FutureTask(new Callable() { - // @Override - // public Object call() throws Exception { - // return interpreter.interpret(code, getInterpreterContext()); - // } - // }); - // FutureTask> completionFuture = - // new FutureTask(new Callable() { - // @Override - // public Object call() throws Exception { - // return interpreter.completion(base, base.length(), null); - // } - // }); + ExecutorService pool = Executors.newFixedThreadPool(2); + FutureTask interpretFuture = + new FutureTask(new Callable() { + @Override + public Object call() throws Exception { + return interpreter.interpret(code, getInterpreterContext()); + } + }); + FutureTask> completionFuture = + new FutureTask(new Callable() { + @Override + public Object call() throws Exception { + return interpreter.completion(base, base.length(), getInterpreterContext()); + } + }); - // pool.execute(interpretFuture); + pool.execute(interpretFuture); // we sleep to ensure that the paragraph is running - // Thread.sleep(3000); - // pool.execute(completionFuture); + Thread.sleep(3000); + pool.execute(completionFuture); // We ensure that running and auto completion are not hanging. - // InterpreterResult res = interpretFuture.get(20000, TimeUnit.MILLISECONDS); - // List autoRes = completionFuture.get(1000, TimeUnit.MILLISECONDS); - InterpreterResult res = interpreter.interpret(code, getInterpreterContext()); - List autoRes = interpreter.completion(base, base.length(), null); - assertTrue(res.code().name().equals("SUCCESS")); + InterpreterResult res = interpretFuture.get(20000, TimeUnit.MILLISECONDS); + List autoRes = completionFuture.get(1000, TimeUnit.MILLISECONDS); + assertTrue(res.code().name().equals("SUCCESS")); assertTrue(autoRes.size() > 0); }