Search in sources :

Example 6 with DependencyResolver

use of org.apache.zeppelin.dep.DependencyResolver in project zeppelin by apache.

the class InstallInterpreter method install.

public void install(String name, String artifact) {
    DependencyResolver depResolver = new DependencyResolver(localRepoDir);
    if (proxyUrl != null) {
        depResolver.setProxy(proxyUrl, proxyUser, proxyPassword);
    }
    File installDir = new File(interpreterBaseDir, name);
    if (installDir.exists()) {
        System.err.println("Directory " + installDir.getAbsolutePath() + " already exists" + "\n\nSkipped");
        return;
    }
    System.out.println("Install " + name + "(" + artifact + ") to " + installDir.getAbsolutePath() + " ... ");
    try {
        depResolver.load(artifact, installDir);
        System.out.println("Interpreter " + name + " installed under " + installDir.getAbsolutePath() + ".");
        startTip();
    } catch (RepositoryException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : RepositoryException(org.sonatype.aether.RepositoryException) IOException(java.io.IOException) File(java.io.File) DependencyResolver(org.apache.zeppelin.dep.DependencyResolver)

Example 7 with DependencyResolver

use of org.apache.zeppelin.dep.DependencyResolver 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 8 with DependencyResolver

use of org.apache.zeppelin.dep.DependencyResolver in project zeppelin by apache.

the class NotebookTest 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();
    notebookDir = new File(tmpDir + "/notebook");
    notebookDir.mkdirs();
    System.setProperty(ConfVars.ZEPPELIN_CONF_DIR.getVarName(), tmpDir.toString() + "/conf");
    System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), tmpDir.getAbsolutePath());
    System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), notebookDir.getAbsolutePath());
    conf = ZeppelinConfiguration.create();
    this.schedulerFactory = new SchedulerFactory();
    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, 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());
    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);
    credentials = new Credentials(conf.credentialsPersist(), conf.getCredentialsPath());
    notebook = new Notebook(conf, notebookRepo, schedulerFactory, factory, interpreterSettingManager, this, search, notebookAuthorization, credentials);
    System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_PUBLIC.getVarName(), "true");
}
Also used : Dependency(org.apache.zeppelin.dep.Dependency) SchedulerFactory(org.apache.zeppelin.scheduler.SchedulerFactory) DependencyResolver(org.apache.zeppelin.dep.DependencyResolver) VFSNotebookRepo(org.apache.zeppelin.notebook.repo.VFSNotebookRepo) SearchService(org.apache.zeppelin.search.SearchService) File(java.io.File) Credentials(org.apache.zeppelin.user.Credentials) Before(org.junit.Before)

Example 9 with DependencyResolver

use of org.apache.zeppelin.dep.DependencyResolver in project zeppelin by apache.

the class HeliumApplicationFactoryTest method setUp.

@Before
public void setUp() throws Exception {
    tmpDir = new File(System.getProperty("java.io.tmpdir") + "/ZepelinLTest_" + System.currentTimeMillis());
    tmpDir.mkdirs();
    File confDir = new File(tmpDir, "conf");
    confDir.mkdirs();
    notebookDir = new File(tmpDir + "/notebook");
    notebookDir.mkdirs();
    File home = // zeppelin/zeppelin-zengine/target/test-classes/note
    new File(getClass().getClassLoader().getResource("note").getFile()).getParentFile().getParentFile().getParentFile().getParentFile();
    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HOME.getVarName(), home.getAbsolutePath());
    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_CONF_DIR.getVarName(), tmpDir.getAbsolutePath() + "/conf");
    System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), notebookDir.getAbsolutePath());
    conf = new ZeppelinConfiguration();
    this.schedulerFactory = new SchedulerFactory();
    heliumAppFactory = new HeliumApplicationFactory();
    depResolver = new DependencyResolver(tmpDir.getAbsolutePath() + "/local-repo");
    interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(true));
    factory = new InterpreterFactory(conf, null, null, heliumAppFactory, depResolver, false, interpreterSettingManager);
    HashMap<String, String> env = new HashMap<>();
    env.put("ZEPPELIN_CLASSPATH", new File("./target/test-classes").getAbsolutePath());
    factory.setEnv(env);
    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(true), new Properties());
    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 = NotebookAuthorization.init(conf);
    notebook = new Notebook(conf, notebookRepo, schedulerFactory, factory, interpreterSettingManager, this, search, notebookAuthorization, new Credentials(false, null));
    heliumAppFactory.setNotebook(notebook);
    notebook.addNotebookEventListener(heliumAppFactory);
    anonymous = new AuthenticationInfo("anonymous");
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Dependency(org.apache.zeppelin.dep.Dependency) Properties(java.util.Properties) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) 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) File(java.io.File) Credentials(org.apache.zeppelin.user.Credentials) Before(org.junit.Before)

Aggregations

DependencyResolver (org.apache.zeppelin.dep.DependencyResolver)9 File (java.io.File)6 Before (org.junit.Before)6 SchedulerFactory (org.apache.zeppelin.scheduler.SchedulerFactory)5 SearchService (org.apache.zeppelin.search.SearchService)5 ArrayList (java.util.ArrayList)4 Properties (java.util.Properties)4 Dependency (org.apache.zeppelin.dep.Dependency)4 HashMap (java.util.HashMap)3 InterpreterFactory (org.apache.zeppelin.interpreter.InterpreterFactory)3 InterpreterOption (org.apache.zeppelin.interpreter.InterpreterOption)3 InterpreterSettingManager (org.apache.zeppelin.interpreter.InterpreterSettingManager)3 VFSNotebookRepo (org.apache.zeppelin.notebook.repo.VFSNotebookRepo)3 Credentials (org.apache.zeppelin.user.Credentials)3 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)2 InterpreterInfo (org.apache.zeppelin.interpreter.InterpreterInfo)2 Notebook (org.apache.zeppelin.notebook.Notebook)2 AuthenticationInfo (org.apache.zeppelin.user.AuthenticationInfo)2 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1