hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jia...@apache.org
Subject hadoop git commit: YARN-5729. Bug fixes for the service Rest API. Contributed by Gour Saha
Date Fri, 14 Oct 2016 20:48:31 GMT
Repository: hadoop
Updated Branches:
  refs/heads/yarn-native-services 1f40ba5bc -> ae71975af


YARN-5729. Bug fixes for the service Rest API. 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/ae71975a
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ae71975a
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ae71975a

Branch: refs/heads/yarn-native-services
Commit: ae71975afd59d31c86f879353bf31cdae9790861
Parents: 1f40ba5
Author: Jian He <jianhe@apache.org>
Authored: Fri Oct 14 13:47:38 2016 -0700
Committer: Jian He <jianhe@apache.org>
Committed: Fri Oct 14 13:47:38 2016 -0700

----------------------------------------------------------------------
 .../services/api/impl/ApplicationApiService.java    | 16 ++++++++++++++--
 .../hadoop/yarn/services/resource/Application.java  |  6 +++---
 .../hadoop/yarn/services/resource/Artifact.java     |  4 +++-
 .../hadoop/yarn/services/resource/Component.java    |  4 +++-
 .../hadoop/yarn/services/resource/ConfigFile.java   |  4 +++-
 .../yarn/services/resource/Configuration.java       |  4 +++-
 .../hadoop/yarn/services/resource/Container.java    |  6 +++---
 .../yarn/services/resource/PlacementPolicy.java     |  4 +++-
 .../yarn/services/resource/ReadinessCheck.java      |  4 +++-
 .../hadoop/yarn/services/resource/Resource.java     |  2 +-
 10 files changed, 39 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/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 0a62629..21cf113 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
@@ -276,7 +276,7 @@ public class ApplicationApiService implements ApplicationApi {
 
     // If it is a simple app with no components, then create a default component
     if (application.getComponents() == null) {
-      application.setComponents(getDefaultComponentAsList());
+      application.setComponents(getDefaultComponentAsList(application));
     }
 
     // Application lifetime if not specified, is set to unlimited lifetime
@@ -1029,7 +1029,8 @@ public class ApplicationApiService implements ApplicationApi {
     // end-users point of view, is out of scope of the REST API. Also, this
     // readiness has nothing to do with readiness-check defined at the component
     // level (which is used for dependency resolution of component DAG).
-    if (totalNumberOfIpAssignedContainers == totalExpectedNumberOfRunningContainers) {
+    if (totalNumberOfIpAssignedContainers
+        .longValue() == totalExpectedNumberOfRunningContainers.longValue()) {
       app.setState(ApplicationState.READY);
     }
     logger.info("Application = {}", app);
@@ -1389,6 +1390,17 @@ public class ApplicationApiService implements ApplicationApi {
     return Response.status(Status.NO_CONTENT).build();
   }
 
+  // create default component and initialize with app level global values
+  private List<Component> getDefaultComponentAsList(Application app) {
+    List<Component> comps = getDefaultComponentAsList();
+    Component comp = comps.get(0);
+    comp.setArtifact(app.getArtifact());
+    comp.setResource(app.getResource());
+    comp.setNumberOfContainers(app.getNumberOfContainers());
+    comp.setLaunchCommand(app.getLaunchCommand());
+    return comps;
+  }
+
   private List<Component> getDefaultComponentAsList() {
     Component comp = new Component();
     comp.setName(DEFAULT_COMPONENT_NAME);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Application.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/Application.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Application.java
index 719bf95..ed65ad2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Application.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Application.java
@@ -168,19 +168,19 @@ public class Application extends BaseResource {
    * The time when the application was created, e.g. 2016-03-16T01:01:49.000Z.
    **/
   public Application launchTime(Date launchTime) {
-    this.launchTime = launchTime;
+    this.launchTime = launchTime == null ? null : (Date) launchTime.clone();
     return this;
   }
 
   @ApiModelProperty(example = "null", value = "The time when the application was created,
e.g. 2016-03-16T01:01:49.000Z.")
   @JsonProperty("launch_time")
   public String getLaunchTime() {
-    return launchTime.toString();
+    return launchTime == null ? null : launchTime.toString();
   }
 
   @XmlElement(name = "launch_time")
   public void setLaunchTime(Date launchTime) {
-    this.launchTime = launchTime;
+    this.launchTime = launchTime == null ? null : (Date) launchTime.clone();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Artifact.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/Artifact.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Artifact.java
index af0ad12..9ac2bc7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Artifact.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Artifact.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.services.resource;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
 import java.util.Objects;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
@@ -33,7 +34,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
 @ApiModel(description = "Artifact of an application component")
 @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen",
date = "2016-06-02T08:15:05.615-07:00")
 @JsonInclude(JsonInclude.Include.NON_NULL)
-public class Artifact {
+public class Artifact implements Serializable {
+  private static final long serialVersionUID = 3608929500111099035L;
 
   private String id = null;
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Component.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/Component.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Component.java
index 1246aa8..75f579a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Component.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Component.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.services.resource;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -42,7 +43,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen",
date = "2016-06-02T08:15:05.615-07:00")
 @XmlRootElement
 @JsonInclude(JsonInclude.Include.NON_NULL)
-public class Component {
+public class Component implements Serializable {
+  private static final long serialVersionUID = -8430058381509087805L;
 
   private String name = null;
   private List<String> dependencies = new ArrayList<String>();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ConfigFile.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/ConfigFile.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ConfigFile.java
index d06c1b8..3ced153 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ConfigFile.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ConfigFile.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.services.resource;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
 import java.util.Objects;
 
 import javax.xml.bind.annotation.XmlElement;
@@ -38,7 +39,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
 @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen",
date = "2016-06-02T08:15:05.615-07:00")
 @XmlRootElement
 @JsonInclude(JsonInclude.Include.NON_NULL)
-public class ConfigFile {
+public class ConfigFile implements Serializable {
+  private static final long serialVersionUID = -7009402089417704612L;
 
   public enum TypeEnum {
     XML("xml"), PROPERTIES("properties"), JSON("json"), YAML("yaml"), TEMPLATE(

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Configuration.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/Configuration.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Configuration.java
index 05983db..908220a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Configuration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Configuration.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.services.resource;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -39,7 +40,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 @ApiModel(description = "Set of configuration properties that can be injected into the application
components via envs, files and custom pluggable helper docker containers. Files of several
standard formats like xml, properties, json, yaml and templates will be supported.")
 @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen",
date = "2016-06-02T08:15:05.615-07:00")
 @JsonInclude(JsonInclude.Include.NON_NULL)
-public class Configuration {
+public class Configuration implements Serializable {
+  private static final long serialVersionUID = -4330788704981074466L;
 
   private Map<String, String> properties = new HashMap<String, String>();
   private Map<String, String> env = new HashMap<String, String>();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/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 4e40102..a4efdf3 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
@@ -73,19 +73,19 @@ public class Container extends BaseResource {
    * This will most likely be different from cluster launch time.
    **/
   public Container launchTime(Date launchTime) {
-    this.launchTime = launchTime;
+    this.launchTime = launchTime == null ? null : (Date) launchTime.clone();
     return this;
   }
 
   @ApiModelProperty(example = "null", value = "The time when the container was created, e.g.
2016-03-16T01:01:49.000Z. This will most likely be different from cluster launch time.")
   @JsonProperty("launch_time")
   public String getLaunchTime() {
-    return launchTime.toString();
+    return launchTime == null ? null : launchTime.toString();
   }
 
   @XmlElement(name = "launch_time")
   public void setLaunchTime(Date launchTime) {
-    this.launchTime = launchTime;
+    this.launchTime = launchTime == null ? null : (Date) launchTime.clone();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/PlacementPolicy.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/PlacementPolicy.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/PlacementPolicy.java
index 7541e2f..5df00a0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/PlacementPolicy.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/PlacementPolicy.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.services.resource;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
 import java.util.Objects;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -31,7 +32,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 
 @ApiModel(description = "Placement policy of an instance of an application. This feature
is in the works in YARN-4902.")
 @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen",
date = "2016-06-02T08:15:05.615-07:00")
-public class PlacementPolicy {
+public class PlacementPolicy implements Serializable {
+  private static final long serialVersionUID = 4341110649551172231L;
 
   private String label = null;
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ReadinessCheck.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/ReadinessCheck.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ReadinessCheck.java
index 10c951a..f549746 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ReadinessCheck.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ReadinessCheck.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.services.resource;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
 import java.util.Objects;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -34,7 +35,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
 
 @ApiModel(description = "A custom command or a pluggable helper container to determine the
readiness of a container of a component. Readiness for every application is different. Hence
the need for a simple interface, with scope to support advanced usecases.")
 @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen",
date = "2016-06-02T08:15:05.615-07:00")
-public class ReadinessCheck {
+public class ReadinessCheck implements Serializable {
+  private static final long serialVersionUID = -3836839816887186801L;
 
   public enum TypeEnum {
     HTTP("http");

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ae71975a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Resource.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/Resource.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Resource.java
index a3780cc..234ccb3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Resource.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/Resource.java
@@ -35,7 +35,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 
 @ApiModel(description = "Resource determines the amount of resources (vcores, memory, network,
etc.) usable by a container. This field determines the resource to be applied for all the
containers of a component or application. The resource specified at the app (or global) level
can be overriden at the component level. Only one of profile OR cpu & memory are exepected.
It raises a validation exception otherwise.")
 @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen",
date = "2016-06-02T08:15:05.615-07:00")
-public class Resource extends BaseResource {
+public class Resource extends BaseResource implements Cloneable {
   private static final long serialVersionUID = -6431667797380250037L;
 
   private String profile = null;


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