hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [34/37] hadoop git commit: YARN-7723. Avoid using docker volume --format option to run against to older docker releases. Contributed by Wangda Tan
Date Tue, 30 Jan 2018 19:29:13 GMT
YARN-7723. Avoid using docker volume --format option to run against to older docker releases.
Contributed by Wangda Tan


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6463e10c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6463e10c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6463e10c

Branch: refs/heads/HDFS-7240
Commit: 6463e10c72344e1720c991307cf2e7b67e112a3a
Parents: f666e7c
Author: Sunil G <sunilg@apache.org>
Authored: Tue Jan 30 15:58:11 2018 +0530
Committer: Sunil G <sunilg@apache.org>
Committed: Tue Jan 30 15:58:11 2018 +0530

----------------------------------------------------------------------
 .../runtime/DockerLinuxContainerRuntime.java    |  9 +------
 .../runtime/TestDockerContainerRuntime.java     | 25 ++++++++++++++++----
 2 files changed, 22 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/6463e10c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
index f3ce73d..601c32c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/DockerLinuxContainerRuntime.java
@@ -437,7 +437,6 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime
{
       throws ContainerExecutionException {
     DockerVolumeCommand dockerVolumeInspectCommand = new DockerVolumeCommand(
         DockerVolumeCommand.VOLUME_LS_SUB_COMMAND);
-    dockerVolumeInspectCommand.setFormat("{{.Name}},{{.Driver}}");
     String output = runDockerVolumeCommand(dockerVolumeInspectCommand,
         container);
 
@@ -450,13 +449,7 @@ public class DockerLinuxContainerRuntime implements LinuxContainerRuntime
{
 
     for (String line : output.split("\n")) {
       line = line.trim();
-      String[] arr = line.split(",");
-      String v = arr[0].trim();
-      String d = null;
-      if (arr.length > 1) {
-        d = arr[1].trim();
-      }
-      if (d != null && volumeName.equals(v) && driverName.equals(d)) {
+      if (line.contains(volumeName) && line.contains(driverName)) {
         // Good we found it.
         LOG.info(
             "Docker volume-name=" + volumeName + " driver-name=" + driverName

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6463e10c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
index 48a96e1..fe4e238 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java
@@ -1473,9 +1473,9 @@ public class TestDockerContainerRuntime {
     commandFile = new File(StringUtils.join(",", op.getArguments()));
     fileInputStream = new FileInputStream(commandFile);
     fileContent = new String(IOUtils.toByteArray(fileInputStream));
-    Assert.assertEquals("[docker-command-execution]\n"
-        + "  docker-command=volume\n" + "  format={{.Name}},{{.Driver}}\n"
-        + "  sub-command=ls\n", fileContent);
+    Assert.assertEquals(
+        "[docker-command-execution]\n" + "  docker-command=volume\n"
+            + "  sub-command=ls\n", fileContent);
     fileInputStream.close();
   }
 
@@ -1577,16 +1577,33 @@ public class TestDockerContainerRuntime {
     // For following tests, we expect to have volume1,local in output
 
     // Failure cases
+    testDockerCommandPluginWithVolumesOutput(
+        "DRIVER              VOLUME NAME\n", true);
     testDockerCommandPluginWithVolumesOutput("", true);
     testDockerCommandPluginWithVolumesOutput("volume1", true);
+    testDockerCommandPluginWithVolumesOutput(
+        "DRIVER              VOLUME NAME\n" +
+        "nvidia-docker       nvidia_driver_375.66\n", true);
+    testDockerCommandPluginWithVolumesOutput(
+        "DRIVER              VOLUME NAME\n" +
+        "                    volume1\n", true);
     testDockerCommandPluginWithVolumesOutput("local", true);
     testDockerCommandPluginWithVolumesOutput("volume2,local", true);
+    testDockerCommandPluginWithVolumesOutput(
+        "DRIVER              VOLUME NAME\n" +
+        "local               volume2\n", true);
     testDockerCommandPluginWithVolumesOutput("volum1,something", true);
+    testDockerCommandPluginWithVolumesOutput(
+        "DRIVER              VOLUME NAME\n" +
+        "something               volume1\n", true);
     testDockerCommandPluginWithVolumesOutput("volum1,something\nvolum2,local",
         true);
 
     // Success case
-    testDockerCommandPluginWithVolumesOutput("volume1,local\n", false);
+    testDockerCommandPluginWithVolumesOutput(
+        "DRIVER              VOLUME NAME\n" +
+        "nvidia-docker       nvidia_driver_375.66\n" +
+        "local               volume1\n", false);
     testDockerCommandPluginWithVolumesOutput(
         "volume_xyz,nvidia\nvolume1,local\n\n", false);
     testDockerCommandPluginWithVolumesOutput(" volume1,  local \n", false);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message