Search in sources :

Example 1 with AngularObjectRegistry

use of org.apache.zeppelin.display.AngularObjectRegistry 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 2 with AngularObjectRegistry

use of org.apache.zeppelin.display.AngularObjectRegistry in project zeppelin by apache.

the class ZeppelinContext method getAngularObject.

private AngularObject getAngularObject(String name, InterpreterContext interpreterContext) {
    AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry();
    String noteId = interpreterContext.getNoteId();
    // try get local object
    AngularObject paragraphAo = registry.get(name, noteId, interpreterContext.getParagraphId());
    AngularObject noteAo = registry.get(name, noteId, null);
    AngularObject ao = paragraphAo != null ? paragraphAo : noteAo;
    if (ao == null) {
        // then global object
        ao = registry.get(name, null, null);
    }
    return ao;
}
Also used : AngularObject(org.apache.zeppelin.display.AngularObject) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry)

Example 3 with AngularObjectRegistry

use of org.apache.zeppelin.display.AngularObjectRegistry 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 4 with AngularObjectRegistry

use of org.apache.zeppelin.display.AngularObjectRegistry in project zeppelin by apache.

the class ZeppelinContext method angularUnbind.

/**
   * Remove angular variable and all the watchers.
   * @param name
   */
private void angularUnbind(String name, String noteId) {
    AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry();
    registry.remove(name, noteId, null);
}
Also used : AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry)

Example 5 with AngularObjectRegistry

use of org.apache.zeppelin.display.AngularObjectRegistry in project zeppelin by apache.

the class DepInterpreterTest method setUp.

@Before
public void setUp() throws Exception {
    Properties p = getTestProperties();
    dep = new DepInterpreter(p);
    dep.open();
    InterpreterGroup intpGroup = new InterpreterGroup();
    intpGroup.put("note", new LinkedList<Interpreter>());
    intpGroup.get("note").add(new SparkInterpreter(p));
    intpGroup.get("note").add(dep);
    dep.setInterpreterGroup(intpGroup);
    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) GUI(org.apache.zeppelin.display.GUI) Properties(java.util.Properties) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry) LinkedList(java.util.LinkedList) Before(org.junit.Before)

Aggregations

AngularObjectRegistry (org.apache.zeppelin.display.AngularObjectRegistry)48 Test (org.junit.Test)20 HashMap (java.util.HashMap)19 LinkedList (java.util.LinkedList)18 GUI (org.apache.zeppelin.display.GUI)18 AuthenticationInfo (org.apache.zeppelin.user.AuthenticationInfo)18 Properties (java.util.Properties)16 AngularObject (org.apache.zeppelin.display.AngularObject)16 LocalResourcePool (org.apache.zeppelin.resource.LocalResourcePool)16 RemoteAngularObjectRegistry (org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry)11 InterpreterGroup (org.apache.zeppelin.interpreter.InterpreterGroup)8 File (java.io.File)5 Map (java.util.Map)5 InterpreterContext (org.apache.zeppelin.interpreter.InterpreterContext)5 Note (org.apache.zeppelin.notebook.Note)5 Before (org.junit.Before)5 InterpreterResult (org.apache.zeppelin.interpreter.InterpreterResult)4 MockInterpreterA (org.apache.zeppelin.interpreter.remote.mock.MockInterpreterA)4 Message (org.apache.zeppelin.notebook.socket.Message)4 Job (org.apache.zeppelin.scheduler.Job)4