mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
fix lint
This commit is contained in:
parent
6e48c13805
commit
5bed19496d
2 changed files with 23 additions and 25 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<InterpreterResult> interpretFuture =
|
||||
// new FutureTask(new Callable() {
|
||||
// @Override
|
||||
// public Object call() throws Exception {
|
||||
// return interpreter.interpret(code, getInterpreterContext());
|
||||
// }
|
||||
// });
|
||||
// FutureTask<List<InterpreterCompletion>> completionFuture =
|
||||
// new FutureTask(new Callable() {
|
||||
// @Override
|
||||
// public Object call() throws Exception {
|
||||
// return interpreter.completion(base, base.length(), null);
|
||||
// }
|
||||
// });
|
||||
ExecutorService pool = Executors.newFixedThreadPool(2);
|
||||
FutureTask<InterpreterResult> interpretFuture =
|
||||
new FutureTask(new Callable() {
|
||||
@Override
|
||||
public Object call() throws Exception {
|
||||
return interpreter.interpret(code, getInterpreterContext());
|
||||
}
|
||||
});
|
||||
FutureTask<List<InterpreterCompletion>> 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<InterpreterCompletion> autoRes = completionFuture.get(1000, TimeUnit.MILLISECONDS);
|
||||
InterpreterResult res = interpreter.interpret(code, getInterpreterContext());
|
||||
List<InterpreterCompletion> autoRes = interpreter.completion(base, base.length(), null);
|
||||
assertTrue(res.code().name().equals("SUCCESS"));
|
||||
InterpreterResult res = interpretFuture.get(20000, TimeUnit.MILLISECONDS);
|
||||
List<InterpreterCompletion> autoRes = completionFuture.get(1000, TimeUnit.MILLISECONDS);
|
||||
assertTrue(res.code().name().equals("SUCCESS"));
|
||||
assertTrue(autoRes.size() > 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue