You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by li...@apache.org on 2019/08/14 04:29:45 UTC

[zeppelin] branch master updated: [ZEPPELIN-4237] Fix zeppelin-interpreter-api.jar path error uploaded to container

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

liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new 146cfe2  [ZEPPELIN-4237] Fix zeppelin-interpreter-api.jar path error uploaded to container
146cfe2 is described below

commit 146cfe27c9b2f9bbc423d134305f1f6b57c1d484
Author: Xun Liu <li...@apache.org>
AuthorDate: Tue Aug 13 22:26:55 2019 +0800

    [ZEPPELIN-4237] Fix zeppelin-interpreter-api.jar path error uploaded to container
    
    ### What is this PR for?
    1. Because the `zeppelin-interpreter-api-<version>.jar` file modifies the path, it needs to be modified accordingly.
    2. Search for the `*.jar` file in the `zeppelin/interpreter/` directory and upload it to the docker container to resolve the issue.
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/ZEPPELIN-4237
    
    ### How should this be tested?
    [CI Pass](https://travis-ci.org/liuxunorg/zeppelin/builds/566415288)
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Xun Liu <li...@apache.org>
    
    Closes #3420 from liuxunorg/ZEPPELIN-4237 and squashes the following commits:
    
    380eed011 [Xun Liu] fixed
    82453a0f1 [Xun Liu] fixed
    6d09ce1fc [Xun Liu] [ZEPPELIN-4237] Fix zeppelin-interpreter-api.jar path error uploaded to container
---
 .../launcher/DockerInterpreterProcess.java         | 32 ++++++++++++++--------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/zeppelin-plugins/launcher/docker/src/main/java/org/apache/zeppelin/interpreter/launcher/DockerInterpreterProcess.java b/zeppelin-plugins/launcher/docker/src/main/java/org/apache/zeppelin/interpreter/launcher/DockerInterpreterProcess.java
index a2f59bf..2af0de9 100644
--- a/zeppelin-plugins/launcher/docker/src/main/java/org/apache/zeppelin/interpreter/launcher/DockerInterpreterProcess.java
+++ b/zeppelin-plugins/launcher/docker/src/main/java/org/apache/zeppelin/interpreter/launcher/DockerInterpreterProcess.java
@@ -31,6 +31,7 @@ import java.net.URI;
 import java.net.URL;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -50,6 +51,8 @@ import com.spotify.docker.client.messages.ExecCreation;
 import com.spotify.docker.client.messages.HostConfig;
 import com.spotify.docker.client.messages.PortBinding;
 import com.spotify.docker.client.messages.ProgressMessage;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.FileFilterUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.zeppelin.conf.ZeppelinConfiguration;
 import org.apache.zeppelin.interpreter.launcher.utils.TarFileEntry;
@@ -452,17 +455,24 @@ public class DockerInterpreterProcess extends RemoteInterpreterProcess {
 
       // 7) ${ZEPPELIN_HOME}/interpreter/spark is uploaded to `${CONTAINER_ZEPPELIN_HOME}`
       //    directory in the container
-      String intpPath = "/interpreter/" + interpreterGroupName;
-      String zeplIntpPath = getPathByHome(zeppelinHome, intpPath);
-      mkdirInContainer(containerId, zeplIntpPath);
-      docker.copyToContainer(new File(zeplIntpPath).toPath(), containerId, zeplIntpPath);
-
-      // 8) ${ZEPPELIN_HOME}/lib/interpreter is uploaded to `${CONTAINER_ZEPPELIN_HOME}`
-      //    directory in the container
-      String libIntpPath = "/lib/interpreter";
-      String zeplLibIntpPath = getPathByHome(zeppelinHome, libIntpPath);
-      mkdirInContainer(containerId, zeplLibIntpPath);
-      docker.copyToContainer(new File(zeplLibIntpPath).toPath(), containerId, zeplLibIntpPath);
+      String intpGrpPath = "/interpreter/" + interpreterGroupName;
+      String intpGrpAllPath = getPathByHome(zeppelinHome, intpGrpPath);
+      mkdirInContainer(containerId, intpGrpAllPath);
+      docker.copyToContainer(new File(intpGrpAllPath).toPath(), containerId, intpGrpAllPath);
+
+      // 8) ${ZEPPELIN_HOME}/lib/interpreter/zeppelin-interpreter-api-<version>.jar
+      //    is uploaded to `${CONTAINER_ZEPPELIN_HOME}` directory in the container
+      String intpPath = "/interpreter";
+      String intpAllPath = getPathByHome(zeppelinHome, intpPath);
+      Collection<File> listFiles = FileUtils.listFiles(new File(intpAllPath),
+          FileFilterUtils.suffixFileFilter("jar"), null);
+      for (File jarfile : listFiles) {
+        String jarfilePath = jarfile.getAbsolutePath();
+        if (!StringUtils.isBlank(jarfilePath)
+            && !copyFiles.containsKey(jarfilePath)) {
+          copyFiles.put(jarfilePath, jarfilePath);
+        }
+      }
     }
 
     deployToContainer(containerId, copyFiles);