Search in sources :

Example 1 with InterpreterFactory

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

the class NoteInterpreterLoaderTest method setUp.

@Before
public void setUp() throws Exception {
    tmpDir = new File(System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis());
    tmpDir.mkdirs();
    new File(tmpDir, "conf").mkdirs();
    System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), tmpDir.getAbsolutePath());
    conf = ZeppelinConfiguration.create();
    depResolver = new DependencyResolver(tmpDir.getAbsolutePath() + "/local-repo");
    interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(true));
    factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager);
    ArrayList<InterpreterInfo> interpreterInfos = new ArrayList<>();
    interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, Maps.<String, Object>newHashMap()));
    interpreterInfos.add(new InterpreterInfo(MockInterpreter11.class.getName(), "mock11", false, Maps.<String, Object>newHashMap()));
    ArrayList<InterpreterInfo> interpreterInfos2 = new ArrayList<>();
    interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, Maps.<String, Object>newHashMap()));
    interpreterSettingManager.add("group1", interpreterInfos, Lists.<Dependency>newArrayList(), new InterpreterOption(), Maps.<String, InterpreterProperty>newHashMap(), "mock", null);
    interpreterSettingManager.add("group2", interpreterInfos2, Lists.<Dependency>newArrayList(), new InterpreterOption(), Maps.<String, InterpreterProperty>newHashMap(), "mock", null);
    interpreterSettingManager.createNewSetting("group1", "group1", Lists.<Dependency>newArrayList(), new InterpreterOption(), new Properties());
    interpreterSettingManager.createNewSetting("group2", "group2", Lists.<Dependency>newArrayList(), new InterpreterOption(), new Properties());
}
Also used : InterpreterOption(org.apache.zeppelin.interpreter.InterpreterOption) ArrayList(java.util.ArrayList) InterpreterInfo(org.apache.zeppelin.interpreter.InterpreterInfo) InterpreterSettingManager(org.apache.zeppelin.interpreter.InterpreterSettingManager) Properties(java.util.Properties) File(java.io.File) InterpreterFactory(org.apache.zeppelin.interpreter.InterpreterFactory) DependencyResolver(org.apache.zeppelin.dep.DependencyResolver) Before(org.junit.Before)

Example 2 with InterpreterFactory

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

the class NotebookRepoSyncTest method setUp.

@Before
public void setUp() throws Exception {
    System.setProperty("zeppelin.isTest", "true");
    ZEPPELIN_HOME = Files.createTempDir();
    new File(ZEPPELIN_HOME, "conf").mkdirs();
    String mainNotePath = ZEPPELIN_HOME.getAbsolutePath() + "/notebook";
    String secNotePath = ZEPPELIN_HOME.getAbsolutePath() + "/notebook_secondary";
    mainNotebookDir = new File(mainNotePath);
    secNotebookDir = new File(secNotePath);
    mainNotebookDir.mkdirs();
    secNotebookDir.mkdirs();
    System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), ZEPPELIN_HOME.getAbsolutePath());
    System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), mainNotebookDir.getAbsolutePath());
    System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), "org.apache.zeppelin.notebook.repo.VFSNotebookRepo,org.apache.zeppelin.notebook.repo.mock.VFSNotebookRepoMock");
    System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_ONE_WAY_SYNC.getVarName(), "false");
    System.setProperty(ConfVars.ZEPPELIN_CONFIG_FS_DIR.getVarName(), ZEPPELIN_HOME.getAbsolutePath() + "/conf");
    System.setProperty(ConfVars.ZEPPELIN_PLUGINS_DIR.getVarName(), new File("../../../plugins").getAbsolutePath());
    LOG.info("main Note dir : " + mainNotePath);
    LOG.info("secondary note dir : " + secNotePath);
    conf = ZeppelinConfiguration.create();
    ConfigStorage.reset();
    interpreterSettingManager = new InterpreterSettingManager(conf, mock(AngularObjectRegistryListener.class), mock(RemoteInterpreterProcessListener.class), mock(ApplicationEventListener.class));
    factory = new InterpreterFactory(interpreterSettingManager);
    notebookRepoSync = new NotebookRepoSync(conf);
    noteManager = new NoteManager(notebookRepoSync, conf);
    authorizationService = new AuthorizationService(noteManager, conf);
    credentials = new Credentials(conf);
    notebook = new Notebook(conf, authorizationService, notebookRepoSync, noteManager, factory, interpreterSettingManager, credentials, null);
    anonymous = new AuthenticationInfo("anonymous");
}
Also used : Notebook(org.apache.zeppelin.notebook.Notebook) AuthorizationService(org.apache.zeppelin.notebook.AuthorizationService) NoteManager(org.apache.zeppelin.notebook.NoteManager) InterpreterSettingManager(org.apache.zeppelin.interpreter.InterpreterSettingManager) File(java.io.File) InterpreterFactory(org.apache.zeppelin.interpreter.InterpreterFactory) Credentials(org.apache.zeppelin.user.Credentials) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) Before(org.junit.Before)

Example 3 with InterpreterFactory

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

the class VFSNotebookRepoTest method setUp.

@Before
public void setUp() throws Exception {
    String zpath = System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis();
    mainZepDir = new File(zpath);
    mainZepDir.mkdirs();
    new File(mainZepDir, "conf").mkdirs();
    String mainNotePath = zpath + "/notebook";
    mainNotebookDir = new File(mainNotePath);
    mainNotebookDir.mkdirs();
    System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), mainZepDir.getAbsolutePath());
    System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), mainNotebookDir.getAbsolutePath());
    System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), "org.apache.zeppelin.notebook.repo.VFSNotebookRepo");
    conf = ZeppelinConfiguration.create();
    this.schedulerFactory = new SchedulerFactory();
    this.schedulerFactory = new SchedulerFactory();
    depResolver = new DependencyResolver(mainZepDir.getAbsolutePath() + "/local-repo");
    interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(true));
    factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager);
    ArrayList<InterpreterInfo> interpreterInfos = new ArrayList<>();
    interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap<String, Object>()));
    interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList<Dependency>(), new InterpreterOption(), Maps.<String, InterpreterProperty>newHashMap(), "mock1", null);
    interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList<Dependency>(), new InterpreterOption(), new Properties());
    SearchService search = mock(SearchService.class);
    notebookRepo = new VFSNotebookRepo(conf);
    notebookAuthorization = NotebookAuthorization.init(conf);
    notebook = new Notebook(conf, notebookRepo, schedulerFactory, factory, interpreterSettingManager, this, search, notebookAuthorization, null);
}
Also used : Notebook(org.apache.zeppelin.notebook.Notebook) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) InterpreterSettingManager(org.apache.zeppelin.interpreter.InterpreterSettingManager) Dependency(org.apache.zeppelin.dep.Dependency) Properties(java.util.Properties) InterpreterFactory(org.apache.zeppelin.interpreter.InterpreterFactory) SchedulerFactory(org.apache.zeppelin.scheduler.SchedulerFactory) DependencyResolver(org.apache.zeppelin.dep.DependencyResolver) InterpreterOption(org.apache.zeppelin.interpreter.InterpreterOption) SearchService(org.apache.zeppelin.search.SearchService) InterpreterInfo(org.apache.zeppelin.interpreter.InterpreterInfo) File(java.io.File) Before(org.junit.Before)

Example 4 with InterpreterFactory

use of org.apache.zeppelin.interpreter.InterpreterFactory in project SSM by Intel-bigdata.

the class NoteInterpreterLoaderTest method setUp.

@Before
public void setUp() throws Exception {
    tmpDir = new File(System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis());
    tmpDir.mkdirs();
    new File(tmpDir, "conf").mkdirs();
    System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), tmpDir.getAbsolutePath());
    conf = ZeppelinConfiguration.create();
    depResolver = new DependencyResolver(tmpDir.getAbsolutePath() + "/local-repo");
    interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(false));
    factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager);
    ArrayList<InterpreterInfo> interpreterInfos = new ArrayList<>();
    interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, Maps.<String, Object>newHashMap()));
    interpreterInfos.add(new InterpreterInfo(MockInterpreter11.class.getName(), "mock11", false, Maps.<String, Object>newHashMap()));
    ArrayList<InterpreterInfo> interpreterInfos2 = new ArrayList<>();
    interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, Maps.<String, Object>newHashMap()));
    interpreterSettingManager.add("group1", interpreterInfos, Lists.<Dependency>newArrayList(), new InterpreterOption(), Maps.<String, InterpreterProperty>newHashMap(), "mock", null);
    interpreterSettingManager.add("group2", interpreterInfos2, Lists.<Dependency>newArrayList(), new InterpreterOption(), Maps.<String, InterpreterProperty>newHashMap(), "mock", null);
    interpreterSettingManager.createNewSetting("group1", "group1", Lists.<Dependency>newArrayList(), new InterpreterOption(), new Properties());
    interpreterSettingManager.createNewSetting("group2", "group2", Lists.<Dependency>newArrayList(), new InterpreterOption(), new Properties());
}
Also used : InterpreterOption(org.apache.zeppelin.interpreter.InterpreterOption) ArrayList(java.util.ArrayList) InterpreterInfo(org.apache.zeppelin.interpreter.InterpreterInfo) InterpreterSettingManager(org.apache.zeppelin.interpreter.InterpreterSettingManager) Properties(java.util.Properties) File(java.io.File) InterpreterFactory(org.apache.zeppelin.interpreter.InterpreterFactory) DependencyResolver(org.apache.zeppelin.dep.DependencyResolver) Before(org.junit.Before)

Example 5 with InterpreterFactory

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

the class MiniZeppelin method start.

public void start(Class clazz) throws IOException {
    zeppelinHome = new File("..");
    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HOME.getVarName(), zeppelinHome.getAbsolutePath());
    confDir = new File(zeppelinHome, "conf_" + clazz.getSimpleName());
    notebookDir = new File(zeppelinHome, "notebook_" + clazz.getSimpleName());
    confDir.mkdirs();
    notebookDir.mkdirs();
    LOGGER.info("ZEPPELIN_HOME: " + zeppelinHome.getAbsolutePath());
    FileUtils.copyFile(new File(zeppelinHome, "conf/log4j.properties"), new File(confDir, "log4j.properties"));
    FileUtils.copyFile(new File(zeppelinHome, "conf/log4j2.properties"), new File(confDir, "log4j2.properties"));
    FileUtils.copyFile(new File(zeppelinHome, "conf/log4j_yarn_cluster.properties"), new File(confDir, "log4j_yarn_cluster.properties"));
    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_CONF_DIR.getVarName(), confDir.getAbsolutePath());
    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), notebookDir.getAbsolutePath());
    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT.getVarName(), "120000");
    conf = ZeppelinConfiguration.create();
    interpreterSettingManager = new InterpreterSettingManager(conf, mock(AngularObjectRegistryListener.class), mock(RemoteInterpreterProcessListener.class), mock(ApplicationEventListener.class));
    interpreterFactory = new InterpreterFactory(interpreterSettingManager);
}
Also used : InterpreterSettingManager(org.apache.zeppelin.interpreter.InterpreterSettingManager) File(java.io.File) InterpreterFactory(org.apache.zeppelin.interpreter.InterpreterFactory)

Aggregations

InterpreterFactory (org.apache.zeppelin.interpreter.InterpreterFactory)6 InterpreterSettingManager (org.apache.zeppelin.interpreter.InterpreterSettingManager)6 File (java.io.File)5 Before (org.junit.Before)5 ArrayList (java.util.ArrayList)3 Properties (java.util.Properties)3 DependencyResolver (org.apache.zeppelin.dep.DependencyResolver)3 InterpreterInfo (org.apache.zeppelin.interpreter.InterpreterInfo)3 InterpreterOption (org.apache.zeppelin.interpreter.InterpreterOption)3 Notebook (org.apache.zeppelin.notebook.Notebook)3 AuthorizationService (org.apache.zeppelin.notebook.AuthorizationService)2 NoteManager (org.apache.zeppelin.notebook.NoteManager)2 Credentials (org.apache.zeppelin.user.Credentials)2 HashMap (java.util.HashMap)1 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)1 Dependency (org.apache.zeppelin.dep.Dependency)1 Interpreter (org.apache.zeppelin.interpreter.Interpreter)1 InterpreterResult (org.apache.zeppelin.interpreter.InterpreterResult)1 InterpreterSetting (org.apache.zeppelin.interpreter.InterpreterSetting)1 ManagedInterpreterGroup (org.apache.zeppelin.interpreter.ManagedInterpreterGroup)1