Search in sources :

Example 1 with InterpreterContext

use of org.apache.zeppelin.interpreter.InterpreterContext in project zeppelin by apache.

the class BeamInterpreterTest method setUp.

@BeforeClass
public static void setUp() {
    Properties p = new Properties();
    beam = new BeamInterpreter(p);
    beam.open();
    context = new InterpreterContext(null, null, null, null, null, null, null, null, null, null, null, null);
}
Also used : Properties(java.util.Properties) InterpreterContext(org.apache.zeppelin.interpreter.InterpreterContext) BeforeClass(org.junit.BeforeClass)

Example 2 with InterpreterContext

use of org.apache.zeppelin.interpreter.InterpreterContext in project zeppelin by apache.

the class ScaldingInterpreterTest method setUp.

@Before
public void setUp() throws Exception {
    tmpDir = new File(System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis());
    System.setProperty("zeppelin.dep.localrepo", tmpDir.getAbsolutePath() + "/local-repo");
    tmpDir.mkdirs();
    if (repl == null) {
        Properties p = new Properties();
        p.setProperty(ScaldingInterpreter.ARGS_STRING, "--local --repl");
        repl = new ScaldingInterpreter(p);
        repl.open();
    }
    InterpreterGroup intpGroup = new InterpreterGroup();
    context = new InterpreterContext("note", "id", null, "title", "text", new AuthenticationInfo(), new HashMap<String, Object>(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), null, new LinkedList<InterpreterContextRunner>(), null);
}
Also used : HashMap(java.util.HashMap) InterpreterGroup(org.apache.zeppelin.interpreter.InterpreterGroup) GUI(org.apache.zeppelin.display.GUI) Properties(java.util.Properties) InterpreterContext(org.apache.zeppelin.interpreter.InterpreterContext) File(java.io.File) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry) LinkedList(java.util.LinkedList) Before(org.junit.Before)

Example 3 with InterpreterContext

use of org.apache.zeppelin.interpreter.InterpreterContext in project zeppelin by apache.

the class ShellInterpreterTest method setUp.

@Before
public void setUp() throws Exception {
    Properties p = new Properties();
    p.setProperty("shell.command.timeout.millisecs", "2000");
    shell = new ShellInterpreter(p);
    context = new InterpreterContext("", "1", null, "", "", null, null, null, null, null, null, null);
    shell.open();
}
Also used : Properties(java.util.Properties) InterpreterContext(org.apache.zeppelin.interpreter.InterpreterContext) Before(org.junit.Before)

Example 4 with InterpreterContext

use of org.apache.zeppelin.interpreter.InterpreterContext in project zeppelin by apache.

the class PythonInterpreterPandasSqlTest method setUp.

@Before
public void setUp() throws Exception {
    Properties p = new Properties();
    p.setProperty("zeppelin.python", "python");
    p.setProperty("zeppelin.python.maxResult", "100");
    intpGroup = new InterpreterGroup();
    python = new PythonInterpreter(p);
    python.setInterpreterGroup(intpGroup);
    python.open();
    sql = new PythonInterpreterPandasSql(p);
    sql.setInterpreterGroup(intpGroup);
    intpGroup.put("note", Arrays.asList(python, sql));
    out = new InterpreterOutput(this);
    context = new InterpreterContext("note", "id", null, "title", "text", new AuthenticationInfo(), new HashMap<String, Object>(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), new LocalResourcePool("id"), new LinkedList<InterpreterContextRunner>(), out);
    // to make sure python is running.
    InterpreterResult ret = python.interpret("\n", context);
    assertEquals(ret.message().toString(), InterpreterResult.Code.SUCCESS, ret.code());
    sql.open();
}
Also used : LocalResourcePool(org.apache.zeppelin.resource.LocalResourcePool) HashMap(java.util.HashMap) InterpreterResult(org.apache.zeppelin.interpreter.InterpreterResult) Properties(java.util.Properties) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) LinkedList(java.util.LinkedList) InterpreterGroup(org.apache.zeppelin.interpreter.InterpreterGroup) InterpreterOutput(org.apache.zeppelin.interpreter.InterpreterOutput) GUI(org.apache.zeppelin.display.GUI) InterpreterContext(org.apache.zeppelin.interpreter.InterpreterContext) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry) Before(org.junit.Before)

Example 5 with InterpreterContext

use of org.apache.zeppelin.interpreter.InterpreterContext in project zeppelin by apache.

the class ZeppelinContext method angularWatch.

private void angularWatch(String name, String noteId, final scala.Function3<Object, Object, InterpreterContext, Unit> func) {
    AngularObjectWatcher w = new AngularObjectWatcher(getInterpreterContext()) {

        @Override
        public void watch(Object oldObject, Object newObject, InterpreterContext context) {
            func.apply(oldObject, newObject, context);
        }
    };
    angularWatch(name, noteId, w);
}
Also used : AngularObjectWatcher(org.apache.zeppelin.display.AngularObjectWatcher) AngularObject(org.apache.zeppelin.display.AngularObject) InterpreterContext(org.apache.zeppelin.interpreter.InterpreterContext)

Aggregations

InterpreterContext (org.apache.zeppelin.interpreter.InterpreterContext)21 Properties (java.util.Properties)9 InterpreterResult (org.apache.zeppelin.interpreter.InterpreterResult)7 Before (org.junit.Before)7 AuthenticationInfo (org.apache.zeppelin.user.AuthenticationInfo)6 AngularObjectRegistry (org.apache.zeppelin.display.AngularObjectRegistry)5 InterpreterGroup (org.apache.zeppelin.interpreter.InterpreterGroup)5 HashMap (java.util.HashMap)4 LinkedList (java.util.LinkedList)4 GUI (org.apache.zeppelin.display.GUI)4 Theory (org.junit.experimental.theories.Theory)4 AngularObjectWatcher (org.apache.zeppelin.display.AngularObjectWatcher)3 Interpreter (org.apache.zeppelin.interpreter.Interpreter)3 InterpreterOutput (org.apache.zeppelin.interpreter.InterpreterOutput)3 LocalResourcePool (org.apache.zeppelin.resource.LocalResourcePool)3 AngularObject (org.apache.zeppelin.display.AngularObject)2 BeforeClass (org.junit.BeforeClass)2 Test (org.junit.Test)2 File (java.io.File)1 IOException (java.io.IOException)1