Search in sources :

Example 1 with SchedulerFactory

use of org.apache.zeppelin.scheduler.SchedulerFactory in project zeppelin by apache.

the class InterpreterFactoryTest 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();
    FileUtils.copyDirectory(new File("src/test/resources/interpreter"), new File(tmpDir, "interpreter"));
    System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), tmpDir.getAbsolutePath());
    System.setProperty(ConfVars.ZEPPELIN_INTERPRETER_GROUP_ORDER.getVarName(), "mock1,mock2,mock11,dev");
    conf = new ZeppelinConfiguration();
    schedulerFactory = new SchedulerFactory();
    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);
    context = new InterpreterContext("note", "id", null, "title", "text", null, null, null, null, null, null, null);
    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);
    Properties intp1Properties = new Properties();
    intp1Properties.put("PROPERTY_1", "VALUE_1");
    intp1Properties.put("property_2", "value_2");
    interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList<Dependency>(), new InterpreterOption(true), intp1Properties);
    ArrayList<InterpreterInfo> interpreterInfos2 = new ArrayList<>();
    interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, new HashMap<String, Object>()));
    interpreterSettingManager.add("mock2", interpreterInfos2, new ArrayList<Dependency>(), new InterpreterOption(), Maps.<String, InterpreterProperty>newHashMap(), "mock2", null);
    interpreterSettingManager.createNewSetting("mock2", "mock2", 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, jobListenerFactory, search, notebookAuthorization, null);
}
Also used : Notebook(org.apache.zeppelin.notebook.Notebook) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Dependency(org.apache.zeppelin.dep.Dependency) Properties(java.util.Properties) SchedulerFactory(org.apache.zeppelin.scheduler.SchedulerFactory) DependencyResolver(org.apache.zeppelin.dep.DependencyResolver) VFSNotebookRepo(org.apache.zeppelin.notebook.repo.VFSNotebookRepo) ZeppelinConfiguration(org.apache.zeppelin.conf.ZeppelinConfiguration) SearchService(org.apache.zeppelin.search.SearchService) Before(org.junit.Before)

Example 2 with SchedulerFactory

use of org.apache.zeppelin.scheduler.SchedulerFactory in project SSM by Intel-bigdata.

the class SmartZeppelinServer method init.

private void init() throws Exception {
    this.depResolver = new DependencyResolver(zconf.getString(ConfVars.ZEPPELIN_INTERPRETER_LOCALREPO));
    InterpreterOutput.limit = zconf.getInt(ConfVars.ZEPPELIN_INTERPRETER_OUTPUT_LIMIT);
    HeliumApplicationFactory heliumApplicationFactory = new HeliumApplicationFactory();
    HeliumVisualizationFactory heliumVisualizationFactory;
    if (isBinaryPackage(zconf)) {
        /* In binary package, zeppelin-web/src/app/visualization and zeppelin-web/src/app/tabledata
       * are copied to lib/node_modules/zeppelin-vis, lib/node_modules/zeppelin-tabledata directory.
       * Check zeppelin/zeppelin-distribution/src/assemble/distribution.xml to see how they're
       * packaged into binary package.
       */
        heliumVisualizationFactory = new HeliumVisualizationFactory(zconf, new File(zconf.getRelativeDir(ConfVars.ZEPPELIN_DEP_LOCALREPO)), new File(zconf.getRelativeDir("lib/node_modules/zeppelin-tabledata")), new File(zconf.getRelativeDir("lib/node_modules/zeppelin-vis")));
    } else {
        heliumVisualizationFactory = new HeliumVisualizationFactory(zconf, new File(zconf.getRelativeDir(ConfVars.ZEPPELIN_DEP_LOCALREPO)), // new File(zconf.getRelativeDir("zeppelin-web/src/app/visualization")));
        new File(zconf.getRelativeDir("smart-zeppelin/zeppelin-web/src/app/tabledata")), new File(zconf.getRelativeDir("smart-zeppelin/zeppelin-web/src/app/visualization")));
    }
    this.helium = new Helium(zconf.getHeliumConfPath(), zconf.getHeliumDefaultLocalRegistryPath(), heliumVisualizationFactory, heliumApplicationFactory);
    // create visualization bundle
    try {
        heliumVisualizationFactory.bundle(helium.getVisualizationPackagesToBundle());
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
    }
    this.schedulerFactory = new SchedulerFactory();
    this.interpreterSettingManager = new InterpreterSettingManager(zconf, depResolver, new InterpreterOption(true));
    this.noteSearchService = new LuceneSearch();
    this.notebookAuthorization = NotebookAuthorization.init(zconf);
    this.credentials = new Credentials(zconf.credentialsPersist(), zconf.getCredentialsPath());
}
Also used : HeliumApplicationFactory(org.apache.zeppelin.helium.HeliumApplicationFactory) InterpreterOption(org.apache.zeppelin.interpreter.InterpreterOption) LuceneSearch(org.apache.zeppelin.search.LuceneSearch) InterpreterSettingManager(org.apache.zeppelin.interpreter.InterpreterSettingManager) Helium(org.apache.zeppelin.helium.Helium) File(java.io.File) Credentials(org.apache.zeppelin.user.Credentials) DependencyResolver(org.apache.zeppelin.dep.DependencyResolver) HeliumVisualizationFactory(org.apache.zeppelin.helium.HeliumVisualizationFactory) SchedulerFactory(org.apache.zeppelin.scheduler.SchedulerFactory)

Example 3 with SchedulerFactory

use of org.apache.zeppelin.scheduler.SchedulerFactory 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)

Aggregations

DependencyResolver (org.apache.zeppelin.dep.DependencyResolver)3 SchedulerFactory (org.apache.zeppelin.scheduler.SchedulerFactory)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Properties (java.util.Properties)2 Dependency (org.apache.zeppelin.dep.Dependency)2 InterpreterOption (org.apache.zeppelin.interpreter.InterpreterOption)2 InterpreterSettingManager (org.apache.zeppelin.interpreter.InterpreterSettingManager)2 Notebook (org.apache.zeppelin.notebook.Notebook)2 SearchService (org.apache.zeppelin.search.SearchService)2 Before (org.junit.Before)2 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)1 Helium (org.apache.zeppelin.helium.Helium)1 HeliumApplicationFactory (org.apache.zeppelin.helium.HeliumApplicationFactory)1 HeliumVisualizationFactory (org.apache.zeppelin.helium.HeliumVisualizationFactory)1 InterpreterFactory (org.apache.zeppelin.interpreter.InterpreterFactory)1 InterpreterInfo (org.apache.zeppelin.interpreter.InterpreterInfo)1 VFSNotebookRepo (org.apache.zeppelin.notebook.repo.VFSNotebookRepo)1 LuceneSearch (org.apache.zeppelin.search.LuceneSearch)1