From f66ecfecf67102f46bae5158403e916e7b92460b Mon Sep 17 00:00:00 2001 From: Jian He Date: Wed, 12 Oct 2016 13:33:09 -0700 Subject: [PATCH] Addendum patch for YARN-5610. Contributed by Gour Saha --- .../yarn/services/resource/Application.java | 44 +++++++++---------- .../services/resource/ApplicationState.java | 5 +++ .../services/resource/ApplicationStatus.java | 8 ++-- .../yarn/services/resource/Artifact.java | 4 +- .../yarn/services/resource/Component.java | 16 ++++--- .../yarn/services/resource/Container.java | 15 ++++--- .../services/resource/ReadinessCheck.java | 6 +-- 7 files changed, 54 insertions(+), 44 deletions(-) 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 cfcae95f030..719bf95e9f5 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 @@ -48,8 +48,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; public class Application extends BaseResource { private static final long serialVersionUID = -4491694636566094885L; - private String id = null; private String name = null; + private String id = null; private Artifact artifact = null; private Resource resource = null; private String launchCommand = null; @@ -63,25 +63,7 @@ public class Application extends BaseResource { private List containers = new ArrayList<>(); private ApplicationState state = null; private Map quicklinks = null; - private String queue; - - /** - * A unique application id. - **/ - public Application id(String id) { - this.id = id; - return this; - } - - @ApiModelProperty(example = "null", required = true, value = "A unique application id.") - @JsonProperty("id") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } + private String queue = null; /** * A unique application name. @@ -101,6 +83,24 @@ public class Application extends BaseResource { this.name = name; } + /** + * A unique application id. + **/ + public Application id(String id) { + this.id = id; + return this; + } + + @ApiModelProperty(example = "null", value = "A unique application id.") + @JsonProperty("id") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + /** * Artifact of single-component applications. Mandatory if components * attribute is not specified. @@ -423,8 +423,8 @@ public class Application extends BaseResource { sb.append(" numberOfRunningContainers: ") .append(toIndentedString(numberOfRunningContainers)).append("\n"); sb.append(" lifetime: ").append(toIndentedString(lifetime)).append("\n"); - sb.append(" placementPolicy: ") - .append(toIndentedString(placementPolicy)).append("\n"); + sb.append(" placementPolicy: ").append(toIndentedString(placementPolicy)) + .append("\n"); sb.append(" components: ").append(toIndentedString(components)) .append("\n"); sb.append(" configuration: ").append(toIndentedString(configuration)) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ApplicationState.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ApplicationState.java index ae96e8a17d1..7f90a9e7ff9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ApplicationState.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ApplicationState.java @@ -17,9 +17,14 @@ package org.apache.hadoop.yarn.services.resource; +import io.swagger.annotations.ApiModel; + /** * The current state of an application. **/ + +@ApiModel(description = "The current state of an application.") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-02T08:15:05.615-07:00") public enum ApplicationState { ACCEPTED, STARTED, READY, STOPPED, FAILED; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ApplicationStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ApplicationStatus.java index 0166b485590..ed826d8d593 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ApplicationStatus.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/resource/ApplicationStatus.java @@ -22,7 +22,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.Objects; -import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import com.fasterxml.jackson.annotation.JsonInclude; @@ -33,7 +32,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * GET API. **/ -@ApiModel(description = "The current status of a submitted application, returned as a response to the GET api") +@ApiModel(description = "The current status of a submitted application, returned as a response to the GET API.") @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) @@ -60,20 +59,19 @@ public class ApplicationStatus extends BaseResource { return diagnostics; } - @XmlElement(name = "diagnostics") public void setDiagnostics(String diagnostics) { this.diagnostics = diagnostics; } /** - * Application state + * Application state. **/ public ApplicationStatus state(ApplicationState state) { this.state = state; return this; } - @ApiModelProperty(example = "null", value = "Application state") + @ApiModelProperty(example = "null", value = "Application state.") @JsonProperty("state") public ApplicationState getState() { return state; 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 aee4d1142c7..af0ad12848c 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 @@ -76,14 +76,14 @@ public class Artifact { } /** - * Artifact type, like docker, tarball, etc. (optional) + * Artifact type, like docker, tarball, etc. (optional). **/ public Artifact type(TypeEnum type) { this.type = type; return this; } - @ApiModelProperty(example = "null", value = "Artifact type, like docker, tarball, etc. (optional)") + @ApiModelProperty(example = "null", value = "Artifact type, like docker, tarball, etc. (optional).") @JsonProperty("type") public TypeEnum getType() { return type; 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 3ff69455ec6..1246aa81c9d 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 @@ -202,8 +202,11 @@ public class Component { * dictates the initial number of components created. Component names * typically differ with a trailing id, but assumptions should not be made on * that, as the algorithm can change at any time. Configurations section will - * be able to use placeholders like ${APP_COMPONENT_NAME} to get its component - * name at runtime, and thereby differing in value at runtime. The best part + * be able to use placeholders like ${USER}, ${CLUSTER_NAME} and + * ${COMPONENT_NAME} to be replaced at runtime with user the app is submitted + * as, application name and application component name respectively. Launch + * command can use placeholders like ${APP_COMPONENT_NAME} and ${APP_NAME} to + * get its component name and app name respectively at runtime. The best part * of this feature is that when the component is flexed up, entirely new * components (with new trailing ids) are created. **/ @@ -212,7 +215,7 @@ public class Component { return this; } - @ApiModelProperty(example = "null", value = "Certain applications need to define multiple components using the same artifact and resource profile, differing only in configurations. In such cases, this field helps app owners to avoid creating multiple component definitions with repeated information. The number_of_containers field dictates the initial number of components created. Component names typically differ with a trailing id, but assumptions should not be made on that, as the algorithm can change at any time. Configurations section will be able to use placeholders like ${APP_COMPONENT_NAME} to get its component name at runtime, and thereby differing in value at runtime. The best part of this feature is that when the component is flexed up, entirely new components (with new trailing ids) are created.") + @ApiModelProperty(example = "null", value = "Certain applications need to define multiple components using the same artifact and resource profile, differing only in configurations. In such cases, this field helps app owners to avoid creating multiple component definitions with repeated information. The number_of_containers field dictates the initial number of components created. Component names typically differ with a trailing id, but assumptions should not be made on that, as the algorithm can change at any time. Configurations section will be able to use placeholders like ${USER}, ${CLUSTER_NAME} and ${COMPONENT_NAME} to be replaced at runtime with user the app is submitted as, application name and application component name respectively. Launch command can use placeholders like ${APP_COMPONENT_NAME} and ${APP_NAME} to get its component name and app name respectively at runtime. The best part of this feature is that when the component is flexed up, entirely new components (with new trailing ids) are created.") @JsonProperty("unique_component_support") public Boolean getUniqueComponentSupport() { return uniqueComponentSupport; @@ -316,8 +319,7 @@ public class Component { && Objects.equals(this.artifact, component.artifact) && Objects.equals(this.launchCommand, component.launchCommand) && Objects.equals(this.resource, component.resource) - && Objects - .equals(this.numberOfContainers, component.numberOfContainers) + && Objects.equals(this.numberOfContainers, component.numberOfContainers) && Objects.equals(this.uniqueComponentSupport, component.uniqueComponentSupport) && Objects.equals(this.runPrivilegedContainer, @@ -354,8 +356,8 @@ public class Component { .append(toIndentedString(uniqueComponentSupport)).append("\n"); sb.append(" runPrivilegedContainer: ") .append(toIndentedString(runPrivilegedContainer)).append("\n"); - sb.append(" placementPolicy: ") - .append(toIndentedString(placementPolicy)).append("\n"); + sb.append(" placementPolicy: ").append(toIndentedString(placementPolicy)) + .append("\n"); sb.append(" configuration: ").append(toIndentedString(configuration)) .append("\n"); sb.append(" quicklinks: ").append(toIndentedString(quicklinks)) 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 2faf6f2a0fa..4e40102632e 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 @@ -29,6 +29,10 @@ import javax.xml.bind.annotation.XmlRootElement; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +/** + * An instance of a running application container. + **/ + @ApiModel(description = "An instance of a running application container") @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-02T08:15:05.615-07:00") @XmlRootElement @@ -47,14 +51,14 @@ public class Container extends BaseResource { /** * Unique container id of a running application, e.g. - * container_e3751_1458061340047_0008_01_000002 + * container_e3751_1458061340047_0008_01_000002. **/ public Container id(String id) { this.id = id; return this; } - @ApiModelProperty(example = "null", value = "Unique container id of a running application, e.g. container_e3751_1458061340047_0008_01_000002") + @ApiModelProperty(example = "null", value = "Unique container id of a running application, e.g. container_e3751_1458061340047_0008_01_000002.") @JsonProperty("id") public String getId() { return id; @@ -65,7 +69,8 @@ public class Container extends BaseResource { } /** - * 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. + * 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. **/ public Container launchTime(Date launchTime) { this.launchTime = launchTime; @@ -126,14 +131,14 @@ public class Container extends BaseResource { /** * The bare node or host in which the container is running, e.g. - * cn008.example.com + * cn008.example.com. **/ public Container bareHost(String bareHost) { this.bareHost = bareHost; return this; } - @ApiModelProperty(example = "null", value = "The bare node or host in which the container is running, e.g. cn008.example.com") + @ApiModelProperty(example = "null", value = "The bare node or host in which the container is running, e.g. cn008.example.com.") @JsonProperty("bare_host") public String getBareHost() { return bareHost; 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 80fdf92ddba..10c951a192f 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 @@ -57,15 +57,15 @@ public class ReadinessCheck { private Artifact artifact = null; /** - * http (YARN will perform a simple REST call at a regular interval and expect - * a 204 No content). + * E.g. HTTP (YARN will perform a simple REST call at a regular interval and + * expect a 204 No content). **/ public ReadinessCheck type(TypeEnum type) { this.type = type; return this; } - @ApiModelProperty(example = "null", value = "http (YARN will perform a simple REST call at a regular interval and expect a 204 No content).") + @ApiModelProperty(example = "null", value = "E.g. HTTP (YARN will perform a simple REST call at a regular interval and expect a 204 No content).") @JsonProperty("type") public TypeEnum getType() { return type;