Repository: hadoop
Updated Branches:
  refs/heads/branch-3.1 4b9eb2188 -> 8f27c35da


YARN-7523. Introduce description and version field in Service record. 
Contributed by Chandni Singh

(cherry picked from commit e1f5251f3c0d6e74af1b52eda6633b728804fe2a)


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

Branch: refs/heads/branch-3.1
Commit: 8f27c35da83528e3085f0dd7ee733aedf690d48f
Parents: 4b9eb21
Author: Billie Rinaldi <bil...@apache.org>
Authored: Sat Mar 10 07:49:10 2018 -0800
Committer: Billie Rinaldi <bil...@apache.org>
Committed: Sat Mar 10 07:53:20 2018 -0800

----------------------------------------------------------------------
 .../hadoop/yarn/service/webapp/ApiServer.java   |  4 +-
 .../definition/YARN-Services-Examples.md        |  6 +++
 ...RN-Simplified-V1-API-Layer-For-Services.yaml |  7 +++
 .../hadoop/yarn/service/TestApiServer.java      |  1 +
 .../src/test/resources/example-app.json         |  1 +
 .../examples/httpd-no-dns/httpd-no-dns.json     |  1 +
 .../examples/httpd/httpd.json                   |  1 +
 .../examples/sleeper/sleeper.json               |  1 +
 .../yarn/service/api/records/Service.java       | 46 +++++++++++++++++++-
 .../exceptions/RestApiErrorMessages.java        |  2 +
 .../yarn/service/utils/ServiceApiUtil.java      |  6 +++
 .../hadoop/yarn/service/ServiceTestUtils.java   |  1 +
 .../hadoop/yarn/service/TestServiceApiUtil.java | 13 ++++++
 .../yarn/service/TestYarnNativeServices.java    |  7 +++
 .../src/test/resources/example-app.json         |  1 +
 .../service/conf/examples/app-override.json     |  1 +
 .../hadoop/yarn/service/conf/examples/app.json  |  1 +
 .../yarn/service/conf/examples/default.json     |  1 +
 .../yarn/service/conf/examples/external0.json   |  1 +
 .../yarn/service/conf/examples/external1.json   |  1 +
 .../yarn/service/conf/examples/external2.json   |  1 +
 .../markdown/yarn-service/YarnServiceAPI.md     |  8 ++++
 22 files changed, 108 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java
index 1528596..df2ad51 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java
@@ -123,8 +123,8 @@ public class ApiServer {
             return null;
           }
         });
-        serviceStatus.setDiagnostics("Service "+service.getName() +
-            " saved.");
+        serviceStatus.setDiagnostics("Service " + service.getName() +
+            " version " + service.getVersion() + " saved.");
       } else {
         ApplicationId applicationId = ugi
             .doAs(new PrivilegedExceptionAction<ApplicationId>() {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Services-Examples.md
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Services-Examples.md
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Services-Examples.md
index 00b21dd..dcbec22 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Services-Examples.md
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/resources/definition/YARN-Services-Examples.md
@@ -21,6 +21,8 @@ POST URL - http://localhost:9191/ws/v1/services
 ```json
 {
   "name": "hello-world",
+  "version": "1.0.0",
+  "description": "hello world example",
   "components" :
     [
       {
@@ -48,6 +50,8 @@ Note, lifetime value of -1 means unlimited lifetime.
 ```json
 {
     "name": "hello-world",
+    "version": "1.0.0",
+    "description": "hello world example",
     "id": "application_1503963985568_0002",
     "lifetime": -1,
     "components": [
@@ -154,6 +158,8 @@ POST URL - http://localhost:9191:/ws/v1/services/hbase-app-1
 ```json
 {
   "name": "hbase-app-1",
+  "version": "1.0.0",
+  "description": "hbase service",
   "lifetime": "3600",
   "components": [
     {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/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 99767b3..17723bc 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
@@ -197,10 +197,17 @@ definitions:
     description: a service resource has the following attributes.
     required:
       - name
+      - version
     properties:
       name:
         type: string
         description: A unique service name. If Registry DNS is enabled, the 
max length is 63 characters.
+      version:
+        type: string
+        description: Version of the service.
+      description:
+        type: string
+        description: Description of the service.
       id:
         type: string
         description: A unique service id.

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/java/org/apache/hadoop/yarn/service/TestApiServer.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/java/org/apache/hadoop/yarn/service/TestApiServer.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/java/org/apache/hadoop/yarn/service/TestApiServer.java
index 4629d28..3c8b5f1 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/java/org/apache/hadoop/yarn/service/TestApiServer.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/java/org/apache/hadoop/yarn/service/TestApiServer.java
@@ -93,6 +93,7 @@ public class TestApiServer {
   public void testGoodCreateService() {
     Service service = new Service();
     service.setName("jenkins");
+    service.setVersion("v1");
     Artifact artifact = new Artifact();
     artifact.setType(TypeEnum.DOCKER);
     artifact.setId("jenkins:latest");

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/resources/example-app.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/resources/example-app.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/resources/example-app.json
index 5dfbd64..a2f41cf 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/resources/example-app.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/test/resources/example-app.json
@@ -1,5 +1,6 @@
 {
   "name": "example-app",
+  "version": "1.0.0",
   "components" :
   [
     {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd-no-dns/httpd-no-dns.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd-no-dns/httpd-no-dns.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd-no-dns/httpd-no-dns.json
index 7bf2f68..b809884 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd-no-dns/httpd-no-dns.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd-no-dns/httpd-no-dns.json
@@ -1,5 +1,6 @@
 {
   "name": "httpd-service-no-dns",
+  "version": "1.0.0",
   "lifetime": "3600",
   "components": [
     {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd/httpd.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd/httpd.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd/httpd.json
index 8786214..849cacc 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd/httpd.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/httpd/httpd.json
@@ -1,5 +1,6 @@
 {
   "name": "httpd-service",
+  "version": "1.0.0",
   "lifetime": "3600",
   "components": [
     {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/sleeper/sleeper.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/sleeper/sleeper.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/sleeper/sleeper.json
index 89ce527..954c704 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/sleeper/sleeper.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/examples/sleeper/sleeper.json
@@ -1,5 +1,6 @@
 {
   "name": "sleeper-service",
+  "version": "1.0.0",
   "components" :
   [
     {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Service.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Service.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Service.java
index 392b71e..7b5c5b3 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Service.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Service.java
@@ -47,8 +47,8 @@ import java.util.Objects;
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.FIELD)
 @JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "name", "state", "resource", "number_of_containers",
-    "lifetime", "containers" })
+@JsonPropertyOrder({ "name", "version", "description", "state", "resource",
+    "number_of_containers", "lifetime", "containers" })
 public class Service extends BaseResource {
   private static final long serialVersionUID = -4491694636566094885L;
 
@@ -74,6 +74,8 @@ public class Service extends BaseResource {
   @JsonProperty("kerberos_principal")
   @XmlElement(name = "kerberos_principal")
   private KerberosPrincipal kerberosPrincipal = new KerberosPrincipal();
+  private String version = null;
+  private String description = null;
 
   /**
    * A unique service name.
@@ -111,6 +113,43 @@ public class Service extends BaseResource {
     this.id = id;
   }
 
+  @ApiModelProperty(example = "null", required = true,
+      value = "Version of the service.")
+  @JsonProperty("version")
+  public String getVersion() {
+    return version;
+  }
+
+  public void setVersion(String version) {
+    this.version = version;
+  }
+
+  /**
+   * Version of the service.
+   */
+  public Service version(String version) {
+    this.version = version;
+    return this;
+  }
+
+  @ApiModelProperty(example = "null", value = "Description of the service.")
+  @JsonProperty("description")
+  public String getDescription() {
+    return description;
+  }
+
+  public void setDescription(String description) {
+    this.description = description;
+  }
+
+  /**
+   * Description of the service.
+   */
+  public Service description(String description) {
+    this.description = description;
+    return this;
+  }
+
   /**
    * Artifact of single-component services. Mandatory if components
    * attribute is not specified.
@@ -380,6 +419,9 @@ public class Service extends BaseResource {
 
     sb.append("    name: ").append(toIndentedString(name)).append("\n");
     sb.append("    id: ").append(toIndentedString(id)).append("\n");
+    sb.append("    version: ").append(toIndentedString(version)).append("\n");
+    sb.append("    description: ").append(toIndentedString(description))
+        .append("\n");
     sb.append("    artifact: 
").append(toIndentedString(artifact)).append("\n");
     sb.append("    resource: 
").append(toIndentedString(resource)).append("\n");
     sb.append("    launchTime: ").append(toIndentedString(launchTime))

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/RestApiErrorMessages.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/RestApiErrorMessages.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/RestApiErrorMessages.java
index ef22b57..12f6455 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/RestApiErrorMessages.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/RestApiErrorMessages.java
@@ -20,6 +20,8 @@ package org.apache.hadoop.yarn.service.exceptions;
 public interface RestApiErrorMessages {
   String ERROR_APPLICATION_NAME_INVALID =
       "Service name is either empty or not provided";
+  String ERROR_APPLICATION_VERSION_INVALID =
+      "Version of service %s is either empty or not provided";
   String ERROR_APPLICATION_NAME_INVALID_FORMAT =
       "Service name %s is not valid - only lower case letters, digits, " +
           "and hyphen are allowed, and the name must be no more " +

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
index a5716bd..0591775 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
@@ -89,6 +89,12 @@ public class ServiceApiUtil {
           RestApiErrorMessages.ERROR_APPLICATION_NAME_INVALID);
     }
 
+    if (StringUtils.isEmpty(service.getVersion())) {
+      throw new IllegalArgumentException(String.format(
+          RestApiErrorMessages.ERROR_APPLICATION_VERSION_INVALID,
+          service.getName()));
+    }
+
     validateNameFormat(service.getName(), conf);
 
     // If the service has no components, throw error

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/ServiceTestUtils.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/ServiceTestUtils.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/ServiceTestUtils.java
index 1117b76..9933211 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/ServiceTestUtils.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/ServiceTestUtils.java
@@ -81,6 +81,7 @@ public class ServiceTestUtils {
   protected Service createExampleApplication() {
     Service exampleApp = new Service();
     exampleApp.setName("example-app");
+    exampleApp.setVersion("v1");
     exampleApp.addComponent(createComponent("compa"));
     exampleApp.addComponent(createComponent("compb"));
     return exampleApp;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestServiceApiUtil.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestServiceApiUtil.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestServiceApiUtil.java
index 55c096e..c2f8f3e 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestServiceApiUtil.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestServiceApiUtil.java
@@ -85,6 +85,17 @@ public class TestServiceApiUtil {
       assertEquals(ERROR_APPLICATION_NAME_INVALID, e.getMessage());
     }
 
+    app.setName("test");
+    // no version
+    try {
+      ServiceApiUtil.validateAndResolveService(app, sfs, CONF_DNS_ENABLED);
+      Assert.fail(EXCEPTION_PREFIX + " service with no version");
+    } catch (IllegalArgumentException e) {
+      assertEquals(String.format(ERROR_APPLICATION_VERSION_INVALID,
+          app.getName()), e.getMessage());
+    }
+
+    app.setVersion("v1");
     // bad format name
     String[] badNames = {"4finance", "Finance", "finance@home", LEN_64_STR};
     for (String badName : badNames) {
@@ -202,6 +213,7 @@ public class TestServiceApiUtil {
 
     Service app = new Service();
     app.setName("service1");
+    app.setVersion("v1");
     Resource res = new Resource();
     app.setResource(res);
     res.setMemory("512M");
@@ -268,6 +280,7 @@ public class TestServiceApiUtil {
   private static Service createValidApplication(String compName) {
     Service app = new Service();
     app.setName("name");
+    app.setVersion("v1");
     app.setResource(createValidResource());
     if (compName != null) {
       app.addComponent(createValidComponent(compName));

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java
index b6126bf..091e624 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java
@@ -144,6 +144,7 @@ public class TestYarnNativeServices extends 
ServiceTestUtils {
     ServiceClient client = createClient();
     Service exampleApp = new Service();
     exampleApp.setName("teststartorder");
+    exampleApp.setVersion("v1");
     exampleApp.addComponent(createComponent("compa", 2, "sleep 1000"));
     Component compb = createComponent("compb", 2, "sleep 1000");
 
@@ -173,9 +174,12 @@ public class TestYarnNativeServices extends 
ServiceTestUtils {
 
     Service userAApp = new Service();
     userAApp.setName(sameAppName);
+    userAApp.setVersion("v1");
     userAApp.addComponent(createComponent("comp", 1, "sleep 1000"));
+
     Service userBApp = new Service();
     userBApp.setName(sameAppName);
+    userBApp.setVersion("v1");
     userBApp.addComponent(createComponent("comp", 1, "sleep 1000"));
 
     File userABasePath = null, userBBasePath = null;
@@ -221,9 +225,12 @@ public class TestYarnNativeServices extends 
ServiceTestUtils {
 
     Service appA = new Service();
     appA.setName(sameAppName);
+    appA.setVersion("v1");
     appA.addComponent(createComponent("comp", 1, "sleep 1000"));
+
     Service appB = new Service();
     appB.setName(sameAppName);
+    appB.setVersion("v1");
     appB.addComponent(createComponent("comp", 1, "sleep 1000"));
 
     try {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/example-app.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/example-app.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/example-app.json
index 5dfbd64..a2f41cf 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/example-app.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/example-app.json
@@ -1,5 +1,6 @@
 {
   "name": "example-app",
+  "version": "1.0.0",
   "components" :
   [
     {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app-override.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app-override.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app-override.json
index 30fa0eb..a4062bc 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app-override.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app-override.json
@@ -1,5 +1,6 @@
 {
   "name": "app-1",
+  "version": "1.0.0",
   "lifetime": "3600",
   "configuration": {
     "properties": {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app.json
index 7e56f1e..9765eaf 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/app.json
@@ -1,5 +1,6 @@
 {
   "name": "app-1",
+  "version": "1.0.0",
   "id" : "application_1503358878042_0011",
   "lifetime": "3600",
   "configuration": {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/default.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/default.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/default.json
index 73d4e7b..fc159c0 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/default.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/default.json
@@ -1,5 +1,6 @@
 {
   "name": "default-app-1",
+  "version": "1.0.0",
   "lifetime": "3600",
   "components" :
   [

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external0.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external0.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external0.json
index f0163bc..8c7af45 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external0.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external0.json
@@ -1,5 +1,6 @@
 {
   "name": "external-0",
+  "version": "1.0.0",
   "lifetime": "3600",
 
   "components" : [

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external1.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external1.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external1.json
index 4afdb8b..b206a77 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external1.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external1.json
@@ -1,5 +1,6 @@
 {
   "name": "external-1",
+  "version": "1.0.0",
   "lifetime": "3600",
   "components": [
     {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external2.json
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external2.json
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external2.json
index 0df8e0a..01445a1 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external2.json
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/resources/org/apache/hadoop/yarn/service/conf/examples/external2.json
@@ -1,5 +1,6 @@
 {
   "name": "external-2",
+  "version": "1.0.0",
   "lifetime": "3600",
   "components": [
     {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f27c35d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/YarnServiceAPI.md
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/YarnServiceAPI.md
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/YarnServiceAPI.md
index 6c38680..9faddeb 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/YarnServiceAPI.md
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/YarnServiceAPI.md
@@ -340,6 +340,8 @@ a service resource has the following attributes.
 |Name|Description|Required|Schema|Default|
 |----|----|----|----|----|
 |name|A unique service name. If Registry DNS is enabled, the max length is 63 
characters.|true|string||
+|version|Version of the service.|true|string||
+|description|Description of the service.|false|string||
 |id|A unique service id.|false|string||
 |artifact|The default artifact for all components of the service except the 
components which has Artifact type set to SERVICE (optional).|false|Artifact||
 |resource|The default resource for all components of the service 
(optional).|false|Resource||
@@ -384,6 +386,8 @@ POST URL - http://localhost:8088/app/v1/services
 ```json
 {
   "name": "hello-world",
+  "version": "1.0.0",
+  "description": "hello world example",
   "components" :
     [
       {
@@ -417,6 +421,8 @@ Note, lifetime value of -1 means unlimited lifetime.
 ```json
 {
     "name": "hello-world",
+    "version": "1.0.0",
+    "description": "hello world example",
     "id": "application_1503963985568_0002",
     "lifetime": -1,
     "components": [
@@ -523,6 +529,8 @@ POST URL - 
http://localhost:8088:/app/v1/services/hbase-app-1
 ```json
 {
   "name": "hbase-app-1",
+  "version": "1.0.0",
+  "description": "hbase service",
   "lifetime": "3600",
   "components": [
     {


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

Reply via email to