use of org.apache.zeppelin.interpreter.InterpreterOutputListener in project zeppelin by apache.
the class SparkInterpreterTest method getInterpreterContext.
private InterpreterContext getInterpreterContext() {
output = "";
InterpreterContext context = InterpreterContext.builder().setInterpreterOut(new InterpreterOutput()).setIntpEventClient(mockRemoteEventClient).setAngularObjectRegistry(new AngularObjectRegistry("spark", null)).build();
context.out = new InterpreterOutput(new InterpreterOutputListener() {
@Override
public void onUpdateAll(InterpreterOutput out) {
}
@Override
public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) {
try {
output = out.toInterpreterResultMessage().getData();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onUpdate(int index, InterpreterResultMessageOutput out) {
messageOutput = out;
}
});
return context;
}
use of org.apache.zeppelin.interpreter.InterpreterOutputListener in project zeppelin by apache.
the class KotlinInterpreterTest method getInterpreterContext.
private static InterpreterContext getInterpreterContext() {
output = "";
InterpreterContext context = InterpreterContext.builder().setInterpreterOut(new InterpreterOutput()).build();
context.out = new InterpreterOutput(new InterpreterOutputListener() {
@Override
public void onUpdateAll(InterpreterOutput out) {
}
@Override
public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) {
try {
output = out.toInterpreterResultMessage().getData();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onUpdate(int index, InterpreterResultMessageOutput out) {
}
});
return context;
}
use of org.apache.zeppelin.interpreter.InterpreterOutputListener in project zeppelin by apache.
the class KotlinSparkInterpreterTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
intpGroup = new InterpreterGroup();
context = InterpreterContext.builder().setNoteId("noteId").setParagraphId("paragraphId").setParagraphTitle("title").setAngularObjectRegistry(new AngularObjectRegistry(intpGroup.getId(), null)).setResourcePool(new LocalResourcePool("id")).setInterpreterOut(new InterpreterOutput()).setIntpEventClient(mock(RemoteInterpreterEventClient.class)).build();
context.out = new InterpreterOutput(new InterpreterOutputListener() {
@Override
public void onUpdateAll(InterpreterOutput out) {
}
@Override
public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) {
try {
output = out.toInterpreterResultMessage().getData();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onUpdate(int index, InterpreterResultMessageOutput out) {
}
});
InterpreterContext.set(context);
intpGroup.put("note", new LinkedList<Interpreter>());
Properties properties = getSparkTestProperties(tmpDir);
repl = new SparkInterpreter(properties);
repl.setInterpreterGroup(intpGroup);
intpGroup.get("note").add(repl);
repl.open();
repl.interpret("sc", context);
interpreter = new KotlinSparkInterpreter(properties);
interpreter.setInterpreterGroup(intpGroup);
intpGroup.get("note").add(interpreter);
try {
interpreter.open();
sparkSupported = true;
} catch (UnsupportedClassVersionError e) {
sparkSupported = false;
}
}
Aggregations