This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a commit to branch branch-0.10
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.10 by this push:
     new a31240878a [ZEPPELIN-5819] Configures ivy to download jar libraries 
only from remote
a31240878a is described below

commit a31240878a5365eb127f851be3d197949c0ea2f4
Author: Philipp Dallig <philipp.dal...@gmail.com>
AuthorDate: Mon Oct 24 08:23:57 2022 +0200

    [ZEPPELIN-5819] Configures ivy to download jar libraries only from remote
    
    ### What is this PR for?
    Configures ivy to download jar libraries only from remote and ignore local 
jars
    
    ### What type of PR is it?
     * Hot Fix
    
    ### What is the Jira issue?
     * https://issues.apache.org/jira/browse/ZEPPELIN-5819
    
    ### How should this be tested?
    * CI
    
    ### Questions:
    * Does the licenses files need to update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Philipp Dallig <philipp.dal...@gmail.com>
    
    Closes #4495 from Reamer/ivy_download and squashes the following commits:
    
    b74631ab3 [Philipp Dallig] Configures ivy to download jar libraries only 
from remote
    
    (cherry picked from commit e70b57c9badfa38263cc85ac62293e2ce0e2d49f)
    Signed-off-by: Philipp Dallig <philipp.dal...@gmail.com>
    
    # Conflicts:
    #       
zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java
---
 .../zeppelin/integration/SparkIntegrationTest.java    | 19 ++++++++++++++++++-
 .../src/test/resources/ivysettings.xml                |  6 ++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git 
a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java
 
b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java
index 1dec6eed1f..dde6cc045b 100644
--- 
a/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java
+++ 
b/zeppelin-interpreter-integration/src/test/java/org/apache/zeppelin/integration/SparkIntegrationTest.java
@@ -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;
@@ -45,6 +46,7 @@ import org.slf4j.LoggerFactory;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.util.EnumSet;
 
 import static org.junit.Assert.assertEquals;
@@ -95,6 +97,18 @@ public abstract class SparkIntegrationTest {
     // 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 void testInterpreterBasics() throws IOException, 
InterpreterException, XmlPullParserException {
     // add jars & packages for testing
     InterpreterSetting sparkInterpreterSetting = 
interpreterSettingManager.getInterpreterSettingByName("spark");
@@ -170,6 +184,7 @@ public abstract class SparkIntegrationTest {
 
     try {
       setUpSparkInterpreterSetting(sparkInterpreterSetting);
+      setupIvySettings(sparkInterpreterSetting);
       testInterpreterBasics();
 
       // no yarn application launched
@@ -199,6 +214,7 @@ public abstract class SparkIntegrationTest {
 
     try {
       setUpSparkInterpreterSetting(sparkInterpreterSetting);
+      setupIvySettings(sparkInterpreterSetting);
       testInterpreterBasics();
 
       // 1 yarn application launched
@@ -251,6 +267,7 @@ public abstract class SparkIntegrationTest {
 
     try {
       setUpSparkInterpreterSetting(sparkInterpreterSetting);
+      setupIvySettings(sparkInterpreterSetting);
       testInterpreterBasics();
 
       // 1 yarn application launched
@@ -333,6 +350,6 @@ public abstract class SparkIntegrationTest {
     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();
   }
 }
diff --git 
a/zeppelin-interpreter-integration/src/test/resources/ivysettings.xml 
b/zeppelin-interpreter-integration/src/test/resources/ivysettings.xml
new file mode 100644
index 0000000000..3b872e1aa1
--- /dev/null
+++ b/zeppelin-interpreter-integration/src/test/resources/ivysettings.xml
@@ -0,0 +1,6 @@
+<ivysettings>
+    <settings defaultResolver="central"/>
+    <resolvers>
+        <ibiblio name="central" m2compatible="true" 
root="https://repo1.maven.org/maven2/"/>
+    </resolvers>
+</ivysettings>

Reply via email to