use of org.apache.zeppelin.interpreter.InterpreterGroup in project zeppelin by apache.
the class FlinkInterpreterTest method setUp.
@Before
public void setUp() throws InterpreterException {
Properties p = new Properties();
p.setProperty("zeppelin.flink.printREPLOutput", "true");
p.setProperty("zeppelin.flink.scala.color", "false");
p.setProperty("flink.execution.mode", "local");
p.setProperty("local.number-taskmanager", "4");
interpreter = new FlinkInterpreter(p);
InterpreterGroup intpGroup = new InterpreterGroup();
interpreter.setInterpreterGroup(intpGroup);
interpreter.open();
angularObjectRegistry = new AngularObjectRegistry("flink", null);
}
use of org.apache.zeppelin.interpreter.InterpreterGroup in project zeppelin by apache.
the class IPyFlinkInterpreterTest method startInterpreter.
@Override
protected void startInterpreter(Properties properties) throws InterpreterException {
InterpreterContext context = getInterpreterContext();
context.setIntpEventClient(mockIntpEventClient);
InterpreterContext.set(context);
this.flinkInnerInterpreter = new FlinkInterpreter(properties);
this.flinkScalaInterpreter = new LazyOpenInterpreter(flinkInnerInterpreter);
intpGroup = new InterpreterGroup();
intpGroup.put("session_1", new ArrayList<Interpreter>());
intpGroup.get("session_1").add(flinkScalaInterpreter);
flinkScalaInterpreter.setInterpreterGroup(intpGroup);
LazyOpenInterpreter pyFlinkInterpreter = new LazyOpenInterpreter(new PyFlinkInterpreter(properties));
intpGroup.get("session_1").add(pyFlinkInterpreter);
pyFlinkInterpreter.setInterpreterGroup(intpGroup);
interpreter = new LazyOpenInterpreter(new IPyFlinkInterpreter(properties));
intpGroup.get("session_1").add(interpreter);
interpreter.setInterpreterGroup(intpGroup);
interpreter.open();
angularObjectRegistry = new AngularObjectRegistry("flink", null);
}
use of org.apache.zeppelin.interpreter.InterpreterGroup in project zeppelin by apache.
the class IPythonKernelTest method setUp.
@Before
public void setUp() throws InterpreterException {
Properties properties = new Properties();
interpreter = new LazyOpenInterpreter(new JupyterInterpreter(properties));
intpGroup = new InterpreterGroup();
resourcePool = new LocalResourcePool("local");
intpGroup.setResourcePool(resourcePool);
intpGroup.put("session_1", new ArrayList<>());
intpGroup.get("session_1").add(interpreter);
interpreter.setInterpreterGroup(intpGroup);
interpreter.open();
}
use of org.apache.zeppelin.interpreter.InterpreterGroup in project SSM by Intel-bigdata.
the class RemoteInterpreterEventPoller method getResource.
private Object getResource(ResourceId resourceId) {
InterpreterGroup intpGroup = InterpreterGroup.getByInterpreterGroupId(resourceId.getResourcePoolId());
if (intpGroup == null) {
return null;
}
RemoteInterpreterProcess remoteInterpreterProcess = intpGroup.getRemoteInterpreterProcess();
if (remoteInterpreterProcess == null) {
ResourcePool localPool = intpGroup.getResourcePool();
if (localPool != null) {
return localPool.get(resourceId.getName());
}
} else if (interpreterProcess.isRunning()) {
Client client = null;
boolean broken = false;
try {
client = remoteInterpreterProcess.getClient();
ByteBuffer res = client.resourceGet(resourceId.getNoteId(), resourceId.getParagraphId(), resourceId.getName());
Object o = Resource.deserializeObject(res);
return o;
} catch (Exception e) {
logger.error(e.getMessage(), e);
broken = true;
} finally {
if (client != null) {
intpGroup.getRemoteInterpreterProcess().releaseClient(client, broken);
}
}
}
return null;
}
use of org.apache.zeppelin.interpreter.InterpreterGroup in project SSM by Intel-bigdata.
the class RemoteInterpreterProcessTest method testStartStop.
@Test
public void testStartStop() {
InterpreterGroup intpGroup = new InterpreterGroup();
RemoteInterpreterManagedProcess rip = new RemoteInterpreterManagedProcess(INTERPRETER_SCRIPT, "nonexists", "fakeRepo", new HashMap<String, String>(), 10 * 1000, null, null);
assertFalse(rip.isRunning());
assertEquals(0, rip.referenceCount());
assertEquals(1, rip.reference(intpGroup, "anonymous", false));
assertEquals(2, rip.reference(intpGroup, "anonymous", false));
assertEquals(true, rip.isRunning());
assertEquals(1, rip.dereference());
assertEquals(true, rip.isRunning());
assertEquals(0, rip.dereference());
assertEquals(false, rip.isRunning());
}
Aggregations