Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 61C36181E1 for ; Fri, 25 Mar 2016 22:57:25 +0000 (UTC) Received: (qmail 79207 invoked by uid 500); 25 Mar 2016 22:57:25 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 79143 invoked by uid 500); 25 Mar 2016 22:57:25 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 79134 invoked by uid 99); 25 Mar 2016 22:57:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Mar 2016 22:57:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 08BD3DFC74; Fri, 25 Mar 2016 22:57:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: asuresh@apache.org To: common-commits@hadoop.apache.org Message-Id: <60b7fd1bb86642a3bf603725674e0a0c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: YARN-4823. Refactor the nested reservation id field in listReservation to simple string field. (subru via asuresh) Date: Fri, 25 Mar 2016 22:57:25 +0000 (UTC) Repository: hadoop Updated Branches: refs/heads/branch-2.8 d2c33ba61 -> 1a194f875 YARN-4823. Refactor the nested reservation id field in listReservation to simple string field. (subru via asuresh) (cherry picked from commit 00bebb7e58ba6899904e1619d151aa1b2f5b6acd) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1a194f87 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1a194f87 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1a194f87 Branch: refs/heads/branch-2.8 Commit: 1a194f8751cec01df8d9d36949802c3c6caad0f1 Parents: d2c33ba Author: Arun Suresh Authored: Fri Mar 25 15:54:38 2016 -0700 Committer: Arun Suresh Committed: Fri Mar 25 15:57:11 2016 -0700 ---------------------------------------------------------------------- .../webapp/dao/ReservationIdInfo.java | 64 -------------------- .../webapp/dao/ReservationInfo.java | 7 +-- .../webapp/TestRMWebServicesReservation.java | 15 ++--- .../src/site/markdown/ResourceManagerRest.md | 27 +++------ 4 files changed, 16 insertions(+), 97 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1a194f87/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationIdInfo.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationIdInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationIdInfo.java deleted file mode 100644 index 3a2596a..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationIdInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.yarn.server.resourcemanager.webapp.dao; - -import org.apache.hadoop.yarn.api.records.ReservationId; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Simple class that represent a reservation ID. - */ -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ReservationIdInfo { - @XmlElement(name = "cluster-timestamp") - private long clusterTimestamp; - - @XmlElement(name = "reservation-id") - private long reservationId; - - public ReservationIdInfo() { - this.clusterTimestamp = 0; - this.reservationId = 0; - } - - public ReservationIdInfo(ReservationId reservationId) { - this.clusterTimestamp = reservationId.getClusterTimestamp(); - this.reservationId = reservationId.getId(); - } - - public long getClusterTimestamp() { - return this.clusterTimestamp; - } - - public void setClusterTimestamp(long newClusterTimestamp) { - this.clusterTimestamp = newClusterTimestamp; - } - - public long getReservationId() { - return this.reservationId; - } - - public void setReservationId(long newReservationId) { - this.reservationId = newReservationId; - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/1a194f87/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationInfo.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationInfo.java index 1a31a8b..8b532ad 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ReservationInfo.java @@ -44,7 +44,7 @@ public class ReservationInfo { private List resourceAllocations = new ArrayList<>(); @XmlElement(name = "reservation-id") - private ReservationIdInfo reservationId; + private String reservationId; @XmlElement(name = "reservation-definition") private ReservationDefinitionInfo reservationDefinition; @@ -55,7 +55,6 @@ public class ReservationInfo { user = ""; reservationDefinition = new ReservationDefinitionInfo(); - reservationId = new ReservationIdInfo(); } public ReservationInfo(ReservationAllocationState allocation, boolean @@ -74,7 +73,7 @@ public class ReservationInfo { } } - reservationId = new ReservationIdInfo(allocation.getReservationId()); + reservationId = allocation.getReservationId().toString(); reservationDefinition = new ReservationDefinitionInfo( allocation.getReservationDefinition()); } @@ -95,7 +94,7 @@ public class ReservationInfo { return resourceAllocations; } - public ReservationIdInfo getReservationId() { + public String getReservationId() { return reservationId; } http://git-wip-us.apache.org/repos/asf/hadoop/blob/1a194f87/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java index 72705d4..a60cf17 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesReservation.java @@ -714,9 +714,8 @@ public class TestRMWebServicesReservation extends JerseyTestBase { testRDLHelper(reservations); - long reservationId = reservations.getJSONObject("reservation-id") - .getLong("reservation-id"); - assertEquals(id1.getId(), reservationId); + String reservationId = reservations.getString("reservation-id"); + assertEquals(id1.toString(), reservationId); rm.stop(); } @@ -769,9 +768,8 @@ public class TestRMWebServicesReservation extends JerseyTestBase { testRDLHelper(reservations); - long reservationId = reservations.getJSONObject("reservation-id") - .getLong("reservation-id"); - assertEquals(id1.getId(), reservationId); + String reservationId = reservations.getString("reservation-id"); + assertEquals(id1.toString(), reservationId); assertTrue(reservations.has("resource-allocations")); @@ -804,9 +802,8 @@ public class TestRMWebServicesReservation extends JerseyTestBase { testRDLHelper(reservations); - long reservationId = reservations.getJSONObject("reservation-id") - .getLong("reservation-id"); - assertEquals(id1.getId(), reservationId); + String reservationId = reservations.getString("reservation-id"); + assertEquals(id1.toString(), reservationId); assertTrue(!reservations.has("resource-allocations")); http://git-wip-us.apache.org/repos/asf/hadoop/blob/1a194f87/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md index 1dcb727..d0250c6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md @@ -3147,7 +3147,7 @@ The Cluster Reservation API can be used to list reservations. When listing reser |:---- |:---- |:---- | | acceptance-time | long | Time that the reservation was accepted | | resource-allocations | array of ResourceAllocationInfo(JSON) / zero or more ResourceAllocationInfo objects(XML) | Resource allocation information for the reservation | -| reservation-id | A single ReservationId object | The unique reservation identifier | +| reservation-id | A single ReservationId string | The unique reservation identifier | | reservation-definition | A single ReservationDefinition Object | A set of constraints representing the need for resources over time of a user | | user | string | User who made the reservation | @@ -3159,21 +3159,14 @@ The Cluster Reservation API can be used to list reservations. When listing reser | startTime | long | Start time that the resource is allocated for | | endTime | long | End time that the resource is allocated for | -### elements of the *resource* object +### Elements of the *resource* object | Item | Data Type | Description | |:---- |:---- |:---- | | memory | int | The memory allocated for the reservation allocation | | vCores | int | The number of cores allocated for the reservation allocation | -### Elements of the *reservation-id* object - -| Item | Data Type | Description | -|:---- |:---- |:---- | -| cluster-timestamp | long | Timestamp representing the time the reservation was created | -| reservation-id | long | The id of the reservation that was listed | - -Elements of the *reservation-definition* object +### Elements of the *reservation-definition* object | Item | Data Type | Description | |:---- |:---- |:---- | @@ -3182,14 +3175,14 @@ Elements of the *reservation-definition* object | reservation-name | string | A mnemonic name of the reservaiton (not a valid identifier). | | reservation-requests | object | A list of "stages" or phases of this reservation, each describing resource requirements and duration | -Elements of the *reservation-requests* object +### Elements of the *reservation-requests* object | Item | Data Type | Description | |:---- |:---- |:---- | | reservation-request-interpreter | int | A numeric choice of how to interpret the set of ReservationRequest: 0 is an ANY, 1 for ALL, 2 for ORDER, 3 for ORDER\_NO\_GAP | | reservation-request | object | The description of the resource and time capabilities for a phase/stage of this reservation | -Elements of the *reservation-request* object +### Elements of the *reservation-request* object | Item | Data Type | Description | |:---- |:---- |:---- | @@ -3253,10 +3246,7 @@ Response Body: "endTime": "1465542252000" } ], - "reservation-id": { - "cluster-timestamp": "1455133859510", - "reservation-id": "6" - }, + "reservation-id": "reservation_1458852875788_0002", "reservation-definition": { "arrival": "1465541532000", "deadline": "1465542252000", @@ -3318,10 +3308,7 @@ Response Body: 1465542251000 1465542252000 - - 1455228059846 - 1 - + reservation_1458852875788_0002 1465541532000 1465542252000