use of org.apache.zeppelin.interpreter.LazyOpenInterpreter in project zeppelin by apache.
the class PySparkInterpreterTest method testFailtoLaunchPythonProcess.
@Override
@Test
public void testFailtoLaunchPythonProcess() throws InterpreterException {
tearDown();
intpGroup = new InterpreterGroup();
Properties properties = new Properties();
properties.setProperty(SparkStringConstants.APP_NAME_PROP_NAME, "Zeppelin Test");
properties.setProperty("spark.pyspark.python", "invalid_python");
properties.setProperty("zeppelin.python.useIPython", "false");
properties.setProperty("zeppelin.python.gatewayserver_address", "127.0.0.1");
properties.setProperty("zeppelin.spark.maxResult", "3");
interpreter = new LazyOpenInterpreter(new PySparkInterpreter(properties));
interpreter.setInterpreterGroup(intpGroup);
Interpreter sparkInterpreter = new LazyOpenInterpreter(new SparkInterpreter(properties));
sparkInterpreter.setInterpreterGroup(intpGroup);
LazyOpenInterpreter iPySparkInterpreter = new LazyOpenInterpreter(new IPySparkInterpreter(properties));
iPySparkInterpreter.setInterpreterGroup(intpGroup);
intpGroup.put("note", new LinkedList<Interpreter>());
intpGroup.get("note").add(interpreter);
intpGroup.get("note").add(sparkInterpreter);
intpGroup.get("note").add(iPySparkInterpreter);
InterpreterContext.set(getInterpreterContext());
try {
interpreter.interpret("1+1", getInterpreterContext());
fail("Should fail to open PySparkInterpreter");
} catch (InterpreterException e) {
String stacktrace = ExceptionUtils.getStackTrace(e);
assertTrue(stacktrace, stacktrace.contains("No such file or directory"));
}
}
use of org.apache.zeppelin.interpreter.LazyOpenInterpreter in project zeppelin by apache.
the class SparkShinyInterpreterTest method setUp.
@Before
public void setUp() throws InterpreterException {
Properties properties = new Properties();
properties.setProperty(SparkStringConstants.MASTER_PROP_NAME, "local[*]");
properties.setProperty(SparkStringConstants.APP_NAME_PROP_NAME, "test");
InterpreterContext context = getInterpreterContext();
InterpreterContext.set(context);
interpreter = new SparkShinyInterpreter(properties);
InterpreterGroup interpreterGroup = new InterpreterGroup();
interpreterGroup.addInterpreterToSession(new LazyOpenInterpreter(interpreter), "session_1");
interpreter.setInterpreterGroup(interpreterGroup);
sparkInterpreter = new SparkInterpreter(properties);
interpreterGroup.addInterpreterToSession(new LazyOpenInterpreter(sparkInterpreter), "session_1");
sparkInterpreter.setInterpreterGroup(interpreterGroup);
interpreter.open();
}
use of org.apache.zeppelin.interpreter.LazyOpenInterpreter 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.LazyOpenInterpreter 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.LazyOpenInterpreter in project SSM by Intel-bigdata.
the class NoteInterpreterLoaderTest method testNoteInterpreterCloseForAll.
@Test
public void testNoteInterpreterCloseForAll() throws IOException {
interpreterSettingManager.setInterpreters("user", "FitstNote", interpreterSettingManager.getDefaultInterpreterSettingList());
interpreterSettingManager.getInterpreterSettings("FitstNote").get(0).getOption().setPerNote(InterpreterOption.SCOPED);
interpreterSettingManager.setInterpreters("user", "yourFirstNote", interpreterSettingManager.getDefaultInterpreterSettingList());
interpreterSettingManager.getInterpreterSettings("yourFirstNote").get(0).getOption().setPerNote(InterpreterOption.ISOLATED);
// interpreters are not created before accessing it
assertNull(interpreterSettingManager.getInterpreterSettings("FitstNote").get(0).getInterpreterGroup("user", "FitstNote").get("FitstNote"));
assertNull(interpreterSettingManager.getInterpreterSettings("yourFirstNote").get(0).getInterpreterGroup("user", "yourFirstNote").get("yourFirstNote"));
Interpreter firstNoteIntp = factory.getInterpreter("user", "FitstNote", "group1.mock1");
Interpreter yourFirstNoteIntp = factory.getInterpreter("user", "yourFirstNote", "group1.mock1");
firstNoteIntp.open();
yourFirstNoteIntp.open();
assertTrue(((LazyOpenInterpreter) firstNoteIntp).isOpen());
assertTrue(((LazyOpenInterpreter) yourFirstNoteIntp).isOpen());
interpreterSettingManager.closeNote("user", "FitstNote");
assertFalse(((LazyOpenInterpreter) firstNoteIntp).isOpen());
assertTrue(((LazyOpenInterpreter) yourFirstNoteIntp).isOpen());
// reopen
firstNoteIntp.open();
assertTrue(((LazyOpenInterpreter) firstNoteIntp).isOpen());
assertTrue(((LazyOpenInterpreter) yourFirstNoteIntp).isOpen());
// invalid check
interpreterSettingManager.closeNote("invalid", "Note");
assertTrue(((LazyOpenInterpreter) firstNoteIntp).isOpen());
assertTrue(((LazyOpenInterpreter) yourFirstNoteIntp).isOpen());
// invalid contains value check
interpreterSettingManager.closeNote("u", "Note");
assertTrue(((LazyOpenInterpreter) firstNoteIntp).isOpen());
assertTrue(((LazyOpenInterpreter) yourFirstNoteIntp).isOpen());
}
Aggregations