Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZEPPELIN-5819] Configures ivy to download jar libraries only from remote #4495

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.zeppelin.integration;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse;
Expand Down Expand Up @@ -46,6 +47,7 @@
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.EnumSet;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -101,6 +103,18 @@ protected void setUpSparkInterpreterSetting(InterpreterSetting interpreterSettin
// sub class can customize spark interpreter setting.
}

/**
* Configures ivy to download jar libraries only from remote.
*
* @param interpreterSetting
* @throws IOException
*/
private void setupIvySettings(InterpreterSetting interpreterSetting) throws IOException {
File ivysettings = new File(zeppelin.getZeppelinConfDir(), "ivysettings.xml");
FileUtils.copyToFile(SparkIntegrationTest.class.getResourceAsStream("/ivysettings.xml"), ivysettings);
interpreterSetting.setProperty("spark.jars.ivySettings", ivysettings.getAbsolutePath());
}

private boolean isHadoopVersionMatch() {
String version = org.apache.hadoop.util.VersionInfo.getVersion();
String majorVersion = version.split("\\.")[0];
Expand Down Expand Up @@ -184,6 +198,7 @@ public void testLocalMode() throws IOException, YarnException, InterpreterExcept

try {
setUpSparkInterpreterSetting(sparkInterpreterSetting);
setupIvySettings(sparkInterpreterSetting);
testInterpreterBasics();

// no yarn application launched
Expand Down Expand Up @@ -215,6 +230,7 @@ public void testYarnClientMode() throws IOException, YarnException, InterruptedE

try {
setUpSparkInterpreterSetting(sparkInterpreterSetting);
setupIvySettings(sparkInterpreterSetting);
testInterpreterBasics();

// 1 yarn application launched
Expand Down Expand Up @@ -270,6 +286,7 @@ public void testYarnClusterMode() throws IOException, YarnException, Interrupted
String yarnAppId = null;
try {
setUpSparkInterpreterSetting(sparkInterpreterSetting);
setupIvySettings(sparkInterpreterSetting);
testInterpreterBasics();

// 1 yarn application launched
Expand Down Expand Up @@ -366,6 +383,6 @@ private String getPythonExec() throws IOException, InterruptedException {
if (process.waitFor() != 0) {
throw new RuntimeException("Fail to run command: which python.");
}
return IOUtils.toString(process.getInputStream()).trim();
return IOUtils.toString(process.getInputStream(), StandardCharsets.UTF_8).trim();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ivysettings>
<settings defaultResolver="central"/>
<resolvers>
<ibiblio name="central" m2compatible="true" root="https://repo1.maven.org/maven2/"/>
</resolvers>
</ivysettings>