hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jia...@apache.org
Subject [41/50] [abbrv] hadoop git commit: YARN-6173. Add artifact info and privileged container details to the container info in API GET response. Contributed by Gour Saha
Date Tue, 18 Apr 2017 06:08:15 GMT
YARN-6173. Add artifact info and privileged container details to the container info in API
GET response. Contributed by Gour Saha


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

Branch: refs/heads/yarn-native-services
Commit: d33f9c6da3440673ae31571f46e410f1fdf864a5
Parents: ef10c96
Author: Billie Rinaldi <billie@apache.org>
Authored: Tue Feb 14 09:52:41 2017 -0800
Committer: Jian He <jianhe@apache.org>
Committed: Tue Apr 18 11:24:19 2017 +0800

----------------------------------------------------------------------
 .../api/impl/ApplicationApiService.java         | 18 +++++++
 .../yarn/services/resource/Container.java       | 53 ++++++++++++++++----
 ...RN-Simplified-V1-API-Layer-For-Services.yaml |  6 +++
 3 files changed, 67 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d33f9c6d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java
index b11da2c..7028caa 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java
@@ -1000,6 +1000,19 @@ public class ApplicationApiService implements ApplicationApi {
               resource.setCpus(jsonGetAsInt(componentRole, "yarn.vcores"));
               resource.setMemory(jsonGetAsString(componentRole, "yarn.memory"));
               container.setResource(resource);
+              Artifact artifact = new Artifact();
+              String dockerImageName = jsonGetAsString(componentRole,
+                  "docker.image");
+              if (StringUtils.isNotEmpty(dockerImageName)) {
+                artifact.setId(dockerImageName);
+                artifact.setType(Artifact.TypeEnum.DOCKER);
+              } else {
+                // Might have to handle tarballs here
+                artifact.setType(null);
+              }
+              container.setArtifact(artifact);
+              container.setPrivilegedContainer(
+                  jsonGetAsBoolean(componentRole, "docker.usePrivileged"));
               // TODO: add container property - for response only?
               app.addContainer(container);
             }
@@ -1057,6 +1070,11 @@ public class ApplicationApiService implements ApplicationApi {
         : object.get(key).isJsonNull() ? null : object.get(key).getAsInt();
   }
 
+  private Boolean jsonGetAsBoolean(JsonObject object, String key) {
+    return object.get(key) == null ? null
+        : object.get(key).isJsonNull() ? null : object.get(key).getAsBoolean();
+  }
+
   private JsonObject jsonGetAsObject(JsonObject object, String key) {
     return object.get(key) == null ? null : object.get(key).getAsJsonObject();
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d33f9c6d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Container.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Container.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Container.java
index f11c7b3..24aada7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Container.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Container.java
@@ -48,6 +48,8 @@ public class Container extends BaseResource {
   private ContainerState state = null;
   private String componentName = null;
   private Resource resource = null;
+  private Artifact artifact = null;
+  private Boolean privilegedContainer = null;
 
   /**
    * Unique container id of a running application, e.g.
@@ -204,6 +206,42 @@ public class Container extends BaseResource {
     this.resource = resource;
   }
 
+  /**
+   * Artifact used for this container.
+   **/
+  public Container artifact(Artifact artifact) {
+    this.artifact = artifact;
+    return this;
+  }
+
+  @ApiModelProperty(example = "null", value = "Artifact used for this container.")
+  @JsonProperty("artifact")
+  public Artifact getArtifact() {
+    return artifact;
+  }
+
+  public void setArtifact(Artifact artifact) {
+    this.artifact = artifact;
+  }
+
+  /**
+   * Container running in privileged mode or not.
+   **/
+  public Container privilegedContainer(Boolean privilegedContainer) {
+    this.privilegedContainer = privilegedContainer;
+    return this;
+  }
+
+  @ApiModelProperty(example = "null", value = "Container running in privileged mode or not.")
+  @JsonProperty("privileged_container")
+  public Boolean getPrivilegedContainer() {
+    return privilegedContainer;
+  }
+
+  public void setPrivilegedContainer(Boolean privilegedContainer) {
+    this.privilegedContainer = privilegedContainer;
+  }
+
   @Override
   public boolean equals(java.lang.Object o) {
     if (this == o) {
@@ -213,20 +251,12 @@ public class Container extends BaseResource {
       return false;
     }
     Container container = (Container) o;
-    return Objects.equals(this.id, container.id)
-        && Objects.equals(this.launchTime, container.launchTime)
-        && Objects.equals(this.ip, container.ip)
-        && Objects.equals(this.hostname, container.hostname)
-        && Objects.equals(this.bareHost, container.bareHost)
-        && Objects.equals(this.state, container.state)
-        && Objects.equals(this.componentName, container.componentName)
-        && Objects.equals(this.resource, container.resource);
+    return Objects.equals(this.id, container.id);
   }
 
   @Override
   public int hashCode() {
-    return Objects.hash(id, launchTime, ip, hostname, bareHost, state,
-        componentName, resource);
+    return Objects.hash(id);
   }
 
   @Override
@@ -244,6 +274,9 @@ public class Container extends BaseResource {
     sb.append("    componentName: ").append(toIndentedString(componentName))
         .append("\n");
     sb.append("    resource: ").append(toIndentedString(resource)).append("\n");
+    sb.append("    artifact: ").append(toIndentedString(artifact)).append("\n");
+    sb.append("    privilegedContainer: ")
+        .append(toIndentedString(privilegedContainer)).append("\n");
     sb.append("}");
     return sb.toString();
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d33f9c6d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Simplified-V1-API-Layer-For-Services.yaml
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Simplified-V1-API-Layer-For-Services.yaml
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Simplified-V1-API-Layer-For-Services.yaml
index 7eb3196..e9239e4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Simplified-V1-API-Layer-For-Services.yaml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Simplified-V1-API-Layer-For-Services.yaml
@@ -379,6 +379,12 @@ definitions:
       resource:
         description: Resource used for this container.
         $ref: '#/definitions/Resource'
+      artifact:
+        description: Artifact used for this container.
+        $ref: '#/definitions/Artifact'
+      privileged_container:
+        type: boolean
+        description: Container running in privileged mode or not.
   ApplicationState:
     description: The current state of an application.
     properties:


---------------------------------------------------------------------
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