You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cd...@apache.org on 2014/10/04 02:10:02 UTC
[04/16] git commit: YARN-1708. Public YARN APIs for
creating/updating/deleting reservations. (cherry picked from commit
3f2e3b275bcf29264a112c5d2f4eae289fe7f52c)
YARN-1708. Public YARN APIs for creating/updating/deleting reservations.
(cherry picked from commit 3f2e3b275bcf29264a112c5d2f4eae289fe7f52c)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c9266df4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c9266df4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c9266df4
Branch: refs/heads/trunk
Commit: c9266df40434fdde05bd3a4c75f7a6bc29db760f
Parents: 1c69503
Author: subru <su...@outlook.com>
Authored: Fri Sep 12 17:16:07 2014 -0700
Committer: Chris Douglas <cd...@apache.org>
Committed: Fri Oct 3 15:41:39 2014 -0700
----------------------------------------------------------------------
YARN-1051-CHANGES.txt | 2 +
.../yarn/api/ApplicationClientProtocol.java | 113 ++++++++++
.../ReservationDeleteRequest.java | 72 ++++++
.../ReservationDeleteResponse.java | 48 ++++
.../ReservationSubmissionRequest.java | 97 ++++++++
.../ReservationSubmissionResponse.java | 78 +++++++
.../ReservationUpdateRequest.java | 96 ++++++++
.../ReservationUpdateResponse.java | 48 ++++
.../records/ApplicationSubmissionContext.java | 22 ++
.../yarn/api/records/ReservationDefinition.java | 137 ++++++++++++
.../hadoop/yarn/api/records/ReservationId.java | 147 ++++++++++++
.../yarn/api/records/ReservationRequest.java | 222 +++++++++++++++++++
.../records/ReservationRequestInterpreter.java | 101 +++++++++
.../yarn/api/records/ReservationRequests.java | 94 ++++++++
.../main/proto/applicationclient_protocol.proto | 3 +
.../src/main/proto/yarn_protos.proto | 37 +++-
.../src/main/proto/yarn_service_protos.proto | 28 +++
.../ApplicationClientProtocolPBClientImpl.java | 58 ++++-
.../ApplicationClientProtocolPBServiceImpl.java | 61 +++++
.../impl/pb/ReservationDeleteRequestPBImpl.java | 127 +++++++++++
.../pb/ReservationDeleteResponsePBImpl.java | 68 ++++++
.../pb/ReservationSubmissionRequestPBImpl.java | 152 +++++++++++++
.../pb/ReservationSubmissionResponsePBImpl.java | 129 +++++++++++
.../impl/pb/ReservationUpdateRequestPBImpl.java | 169 ++++++++++++++
.../pb/ReservationUpdateResponsePBImpl.java | 68 ++++++
.../pb/ApplicationSubmissionContextPBImpl.java | 36 ++-
.../yarn/api/records/impl/pb/ProtoUtils.java | 17 ++
.../impl/pb/ReservationDefinitionPBImpl.java | 169 ++++++++++++++
.../records/impl/pb/ReservationIdPBImpl.java | 75 +++++++
.../impl/pb/ReservationRequestPBImpl.java | 152 +++++++++++++
.../impl/pb/ReservationRequestsPBImpl.java | 189 ++++++++++++++++
.../org/apache/hadoop/yarn/util/UTCClock.java | 39 ++++
32 files changed, 2848 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/YARN-1051-CHANGES.txt
----------------------------------------------------------------------
diff --git a/YARN-1051-CHANGES.txt b/YARN-1051-CHANGES.txt
index 9fd4b3b..a7c08a0 100644
--- a/YARN-1051-CHANGES.txt
+++ b/YARN-1051-CHANGES.txt
@@ -3,3 +3,5 @@ CapacityScheduler. (Carlo Curino and Subru Krishnan via curino)
YARN-2475. Logic for responding to capacity drops for the
ReservationSystem. (Carlo Curino and Subru Krishnan via curino)
+
+YARN-1708. Public YARN APIs for creating/updating/deleting reservations. (subru)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java
index e449c1e..863a068 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java
@@ -57,6 +57,12 @@ import org.apache.hadoop.yarn.api.protocolrecords.MoveApplicationAcrossQueuesReq
import org.apache.hadoop.yarn.api.protocolrecords.MoveApplicationAcrossQueuesResponse;
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest;
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse;
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
@@ -67,6 +73,7 @@ import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
import org.apache.hadoop.yarn.api.records.ContainerReport;
import org.apache.hadoop.yarn.api.records.NodeReport;
+import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.api.records.Token;
@@ -543,4 +550,110 @@ public interface ApplicationClientProtocol {
public GetContainersResponse getContainers(GetContainersRequest request)
throws YarnException, IOException;
+ /**
+ * <p>
+ * The interface used by clients to submit a new reservation to the
+ * {@link ResourceManager}.
+ * </p>
+ *
+ * <p>
+ * The client packages all details of its request in a
+ * {@link ReservationSubmissionRequest} object. This contains information
+ * about the amount of capacity, temporal constraints, and concurrency needs.
+ * Furthermore, the reservation might be composed of multiple stages, with
+ * ordering dependencies among them.
+ * </p>
+ *
+ * <p>
+ * In order to respond, a new admission control component in the
+ * {@link ResourceManager} performs an analysis of the resources that have
+ * been committed over the period of time the user is requesting, verify that
+ * the user requests can be fulfilled, and that it respect a sharing policy
+ * (e.g., {@link CapacityOverTimePolicy}). Once it has positively determined
+ * that the ReservationSubmissionRequest is satisfiable the
+ * {@link ResourceManager} answers with a
+ * {@link ReservationSubmissionResponse} that include a non-null
+ * {@link ReservationId}. Upon failure to find a valid allocation the response
+ * is an exception with the reason.
+ *
+ * On application submission the client can use this {@link ReservationId} to
+ * obtain access to the reserved resources.
+ * </p>
+ *
+ * <p>
+ * The system guarantees that during the time-range specified by the user, the
+ * reservationID will be corresponding to a valid reservation. The amount of
+ * capacity dedicated to such queue can vary overtime, depending of the
+ * allocation that has been determined. But it is guaranteed to satisfy all
+ * the constraint expressed by the user in the
+ * {@link ReservationSubmissionRequest}.
+ * </p>
+ *
+ * @param request the request to submit a new Reservation
+ * @return response the {@link ReservationId} on accepting the submission
+ * @throws YarnException if the request is invalid or reservation cannot be
+ * created successfully
+ * @throws IOException
+ *
+ */
+ @Public
+ @Unstable
+ public ReservationSubmissionResponse submitReservation(
+ ReservationSubmissionRequest request) throws YarnException, IOException;
+
+ /**
+ * <p>
+ * The interface used by clients to update an existing Reservation. This is
+ * referred to as a re-negotiation process, in which a user that has
+ * previously submitted a Reservation.
+ * </p>
+ *
+ * <p>
+ * The allocation is attempted by virtually substituting all previous
+ * allocations related to this Reservation with new ones, that satisfy the new
+ * {@link ReservationUpdateRequest}. Upon success the previous allocation is
+ * substituted by the new one, and on failure (i.e., if the system cannot find
+ * a valid allocation for the updated request), the previous allocation
+ * remains valid.
+ *
+ * The {@link ReservationId} is not changed, and applications currently
+ * running within this reservation will automatically receive the resources
+ * based on the new allocation.
+ * </p>
+ *
+ * @param request to update an existing Reservation (the ReservationRequest
+ * should refer to an existing valid {@link ReservationId})
+ * @return response empty on successfully updating the existing reservation
+ * @throws YarnException if the request is invalid or reservation cannot be
+ * updated successfully
+ * @throws IOException
+ *
+ */
+ @Public
+ @Unstable
+ public ReservationUpdateResponse updateReservation(
+ ReservationUpdateRequest request) throws YarnException, IOException;
+
+ /**
+ * <p>
+ * The interface used by clients to remove an existing Reservation.
+ *
+ * Upon deletion of a reservation applications running with this reservation,
+ * are automatically downgraded to normal jobs running without any dedicated
+ * reservation.
+ * </p>
+ *
+ * @param request to remove an existing Reservation (the ReservationRequest
+ * should refer to an existing valid {@link ReservationId})
+ * @return response empty on successfully deleting the existing reservation
+ * @throws YarnException if the request is invalid or reservation cannot be
+ * deleted successfully
+ * @throws IOException
+ *
+ */
+ @Public
+ @Unstable
+ public ReservationDeleteResponse deleteReservation(
+ ReservationDeleteRequest request) throws YarnException, IOException;
+
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteRequest.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteRequest.java
new file mode 100644
index 0000000..1dd876b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteRequest.java
@@ -0,0 +1,72 @@
+/**
+ * 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.api.protocolrecords;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ReservationDefinition;
+import org.apache.hadoop.yarn.api.records.ReservationId;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * {@link ReservationDeleteRequest} captures the set of requirements the user
+ * has to delete an existing reservation.
+ *
+ * @see ReservationDefinition
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationDeleteRequest {
+
+ @Public
+ @Unstable
+ public static ReservationDeleteRequest newInstance(ReservationId reservationId) {
+ ReservationDeleteRequest request =
+ Records.newRecord(ReservationDeleteRequest.class);
+ request.setReservationId(reservationId);
+ return request;
+ }
+
+ /**
+ * Get the {@link ReservationId}, that corresponds to a valid resource
+ * allocation in the scheduler (between start and end time of this
+ * reservation)
+ *
+ * @return the {@link ReservationId} representing the unique id of the
+ * corresponding reserved resource allocation in the scheduler
+ */
+ @Public
+ @Unstable
+ public abstract ReservationId getReservationId();
+
+ /**
+ * Set the {@link ReservationId}, that correspond to a valid resource
+ * allocation in the scheduler (between start and end time of this
+ * reservation)
+ *
+ * @param reservationId the {@link ReservationId} representing the the unique
+ * id of the corresponding reserved resource allocation in the
+ * scheduler
+ */
+ @Public
+ @Unstable
+ public abstract void setReservationId(ReservationId reservationId);
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteResponse.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteResponse.java
new file mode 100644
index 0000000..eedd3a4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteResponse.java
@@ -0,0 +1,48 @@
+/**
+ * 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.api.protocolrecords;
+
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ReservationDefinition;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * {@link ReservationDeleteResponse} contains the answer of the admission
+ * control system in the {@link ResourceManager} to a reservation delete
+ * operation. Currently response is empty if the operation was successful, if
+ * not an exception reporting reason for a failure.
+ *
+ * @see ReservationDefinition
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationDeleteResponse {
+
+ @Private
+ @Unstable
+ public static ReservationDeleteResponse newInstance() {
+ ReservationDeleteResponse response =
+ Records.newRecord(ReservationDeleteResponse.class);
+ return response;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionRequest.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionRequest.java
new file mode 100644
index 0000000..e550fe2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionRequest.java
@@ -0,0 +1,97 @@
+/**
+ * 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.api.protocolrecords;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.QueueInfo;
+import org.apache.hadoop.yarn.api.records.ReservationDefinition;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * {@link ReservationSubmissionRequest} captures the set of requirements the
+ * user has to create a reservation.
+ *
+ * @see ReservationDefinition
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationSubmissionRequest {
+
+ @Public
+ @Unstable
+ public static ReservationSubmissionRequest newInstance(
+ ReservationDefinition reservationDefinition, String queueName) {
+ ReservationSubmissionRequest request =
+ Records.newRecord(ReservationSubmissionRequest.class);
+ request.setReservationDefinition(reservationDefinition);
+ request.setQueue(queueName);
+ return request;
+ }
+
+ /**
+ * Get the {@link ReservationDefinition} representing the user constraints for
+ * this reservation
+ *
+ * @return the reservation definition representing user constraints
+ */
+ @Public
+ @Unstable
+ public abstract ReservationDefinition getReservationDefinition();
+
+ /**
+ * Set the {@link ReservationDefinition} representing the user constraints for
+ * this reservation
+ *
+ * @param reservationDefinition the reservation request representing the
+ * reservation
+ */
+ @Public
+ @Unstable
+ public abstract void setReservationDefinition(
+ ReservationDefinition reservationDefinition);
+
+ /**
+ * Get the name of the {@link Plan} that corresponds to the name of the
+ * {@link QueueInfo} in the scheduler to which the reservation will be
+ * submitted to.
+ *
+ * @return the name of the {@link Plan} that corresponds to the name of the
+ * {@link QueueInfo} in the scheduler to which the reservation will be
+ * submitted to
+ */
+ @Public
+ @Unstable
+ public abstract String getQueue();
+
+ /**
+ * Set the name of the {@link Plan} that corresponds to the name of the
+ * {@link QueueInfo} in the scheduler to which the reservation will be
+ * submitted to
+ *
+ * @param the name of the parent {@link Plan} that corresponds to the name of
+ * the {@link QueueInfo} in the scheduler to which the reservation
+ * will be submitted to
+ */
+ @Public
+ @Unstable
+ public abstract void setQueue(String queueName);
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionResponse.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionResponse.java
new file mode 100644
index 0000000..b57ef52
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionResponse.java
@@ -0,0 +1,78 @@
+/**
+ * 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.api.protocolrecords;
+
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ReservationDefinition;
+import org.apache.hadoop.yarn.api.records.ReservationId;
+import org.apache.hadoop.yarn.util.Records;
+
+import com.sun.naming.internal.ResourceManager;
+
+/**
+ * {@link ReservationSubmissionResponse} contains the answer of the admission
+ * control system in the {@link ResourceManager} to a reservation create
+ * operation. Response contains a {@link ReservationId} if the operation was
+ * successful, if not an exception reporting reason for a failure.
+ *
+ * @see ReservationDefinition
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationSubmissionResponse {
+
+ @Private
+ @Unstable
+ public static ReservationSubmissionResponse newInstance(
+ ReservationId reservationId) {
+ ReservationSubmissionResponse response =
+ Records.newRecord(ReservationSubmissionResponse.class);
+ response.setReservationId(reservationId);
+ return response;
+ }
+
+ /**
+ * Get the {@link ReservationId}, that corresponds to a valid resource
+ * allocation in the scheduler (between start and end time of this
+ * reservation)
+ *
+ * @return the {@link ReservationId} representing the unique id of the
+ * corresponding reserved resource allocation in the scheduler
+ */
+ @Public
+ @Unstable
+ public abstract ReservationId getReservationId();
+
+ /**
+ * Set the {@link ReservationId}, that correspond to a valid resource
+ * allocation in the scheduler (between start and end time of this
+ * reservation)
+ *
+ * @param reservationId the {@link ReservationId} representing the the unique
+ * id of the corresponding reserved resource allocation in the
+ * scheduler
+ */
+ @Private
+ @Unstable
+ public abstract void setReservationId(ReservationId reservationId);
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateRequest.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateRequest.java
new file mode 100644
index 0000000..b5a4b7b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateRequest.java
@@ -0,0 +1,96 @@
+/**
+ * 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.api.protocolrecords;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ReservationDefinition;
+import org.apache.hadoop.yarn.api.records.ReservationId;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * {@link ReservationUpdateRequest} captures the set of requirements the user
+ * has to update an existing reservation.
+ *
+ * @see ReservationDefinition
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationUpdateRequest {
+
+ @Public
+ @Unstable
+ public static ReservationUpdateRequest newInstance(
+ ReservationDefinition reservationDefinition, ReservationId reservationId) {
+ ReservationUpdateRequest request =
+ Records.newRecord(ReservationUpdateRequest.class);
+ request.setReservationDefinition(reservationDefinition);
+ request.setReservationId(reservationId);
+ return request;
+ }
+
+ /**
+ * Get the {@link ReservationDefinition} representing the updated user
+ * constraints for this reservation
+ *
+ * @return the reservation definition representing user constraints
+ */
+ @Public
+ @Unstable
+ public abstract ReservationDefinition getReservationDefinition();
+
+ /**
+ * Set the {@link ReservationDefinition} representing the updated user
+ * constraints for this reservation
+ *
+ * @param reservationDefinition the reservation request representing the
+ * reservation
+ */
+ @Public
+ @Unstable
+ public abstract void setReservationDefinition(
+ ReservationDefinition reservationDefinition);
+
+ /**
+ * Get the {@link ReservationId}, that corresponds to a valid resource
+ * allocation in the scheduler (between start and end time of this
+ * reservation)
+ *
+ * @return the {@link ReservationId} representing the unique id of the
+ * corresponding reserved resource allocation in the scheduler
+ */
+ @Public
+ @Unstable
+ public abstract ReservationId getReservationId();
+
+ /**
+ * Set the {@link ReservationId}, that correspond to a valid resource
+ * allocation in the scheduler (between start and end time of this
+ * reservation)
+ *
+ * @param reservationId the {@link ReservationId} representing the the unique
+ * id of the corresponding reserved resource allocation in the
+ * scheduler
+ */
+ @Public
+ @Unstable
+ public abstract void setReservationId(ReservationId reservationId);
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateResponse.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateResponse.java
new file mode 100644
index 0000000..bfd2d51
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateResponse.java
@@ -0,0 +1,48 @@
+/**
+ * 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.api.protocolrecords;
+
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ReservationDefinition;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * {@link ReservationUpdateResponse} contains the answer of the admission
+ * control system in the {@link ResourceManager} to a reservation update
+ * operation. Currently response is empty if the operation was successful, if
+ * not an exception reporting reason for a failure.
+ *
+ * @see ReservationDefinition
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationUpdateResponse {
+
+ @Private
+ @Unstable
+ public static ReservationUpdateResponse newInstance() {
+ ReservationUpdateResponse response =
+ Records.newRecord(ReservationUpdateResponse.class);
+ return response;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
index 2202380..cbf1e37 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
@@ -417,4 +417,26 @@ public abstract class ApplicationSubmissionContext {
@Stable
public abstract void setLogAggregationContext(
LogAggregationContext logAggregationContext);
+
+ /**
+ * Get the reservation id, that corresponds to a valid resource allocation in
+ * the scheduler (between start and end time of the corresponding reservation)
+ *
+ * @return the reservation id representing the unique id of the corresponding
+ * reserved resource allocation in the scheduler
+ */
+ @Public
+ @Unstable
+ public abstract ReservationId getReservationID();
+
+ /**
+ * Set the reservation id, that correspond to a valid resource allocation in
+ * the scheduler (between start and end time of the corresponding reservation)
+ *
+ * @param reservationId representing the unique id of the
+ * corresponding reserved resource allocation in the scheduler
+ */
+ @Public
+ @Unstable
+ public abstract void setReservationID(ReservationId reservationID);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationDefinition.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationDefinition.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationDefinition.java
new file mode 100644
index 0000000..c94463d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationDefinition.java
@@ -0,0 +1,137 @@
+/**
+ * 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.api.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Evolving;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * {@link ReservationDefinition} captures the set of resource and time
+ * constraints the user cares about regarding a reservation.
+ *
+ * @see ResourceRequest
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationDefinition {
+
+ @Public
+ @Unstable
+ public static ReservationDefinition newInstance(long arrival, long deadline,
+ ReservationRequests reservationRequests, String name) {
+ ReservationDefinition rDefinition =
+ Records.newRecord(ReservationDefinition.class);
+ rDefinition.setArrival(arrival);
+ rDefinition.setDeadline(deadline);
+ rDefinition.setReservationRequests(reservationRequests);
+ rDefinition.setReservationName(name);
+ return rDefinition;
+ }
+
+ /**
+ * Get the arrival time or the earliest time from which the resource(s) can be
+ * allocated. Time expressed as UTC.
+ *
+ * @return the earliest valid time for this reservation
+ */
+ @Public
+ @Unstable
+ public abstract long getArrival();
+
+ /**
+ * Set the arrival time or the earliest time from which the resource(s) can be
+ * allocated. Time expressed as UTC.
+ *
+ * @param earliestStartTime the earliest valid time for this reservation
+ */
+ @Public
+ @Unstable
+ public abstract void setArrival(long earliestStartTime);
+
+ /**
+ * Get the deadline or the latest time by when the resource(s) must be
+ * allocated. Time expressed as UTC.
+ *
+ * @return the deadline or the latest time by when the resource(s) must be
+ * allocated
+ */
+ @Public
+ @Unstable
+ public abstract long getDeadline();
+
+ /**
+ * Set the deadline or the latest time by when the resource(s) must be
+ * allocated. Time expressed as UTC.
+ *
+ * @param latestEndTime the deadline or the latest time by when the
+ * resource(s) should be allocated
+ */
+ @Public
+ @Unstable
+ public abstract void setDeadline(long latestEndTime);
+
+ /**
+ * Get the list of {@link ReservationRequests} representing the resources
+ * required by the application
+ *
+ * @return the list of {@link ReservationRequests}
+ */
+ @Public
+ @Unstable
+ public abstract ReservationRequests getReservationRequests();
+
+ /**
+ * Set the list of {@link ReservationRequests} representing the resources
+ * required by the application
+ *
+ * @param resources the list of {@link ReservationRequests}
+ */
+ @Public
+ @Unstable
+ public abstract void setReservationRequests(
+ ReservationRequests reservationRequests);
+
+ /**
+ * Get the name for this reservation. The name need-not be unique, and it is
+ * just a mnemonic for the user (akin to job names). Accepted reservations are
+ * uniquely identified by a system-generated ReservationId.
+ *
+ * @return string representing the name of the corresponding reserved resource
+ * allocation in the scheduler
+ */
+ @Public
+ @Evolving
+ public abstract String getReservationName();
+
+ /**
+ * Set the name for this reservation. The name need-not be unique, and it is
+ * just a mnemonic for the user (akin to job names). Accepted reservations are
+ * uniquely identified by a system-generated ReservationId.
+ *
+ * @param name representing the name of the corresponding reserved resource
+ * allocation in the scheduler
+ */
+ @Public
+ @Evolving
+ public abstract void setReservationName(String name);
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
new file mode 100644
index 0000000..47a8c40
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
@@ -0,0 +1,147 @@
+/**
+ * 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.api.records;
+
+import java.text.NumberFormat;
+
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * <p>
+ * {@link ReservationId} represents the <em>globally unique</em> identifier for
+ * a reservation.
+ * </p>
+ *
+ * <p>
+ * The globally unique nature of the identifier is achieved by using the
+ * <em>cluster timestamp</em> i.e. start-time of the {@link ResourceManager}
+ * along with a monotonically increasing counter for the reservation.
+ * </p>
+ */
+@Public
+@Unstable
+public abstract class ReservationId implements Comparable<ReservationId> {
+
+ @Private
+ @Unstable
+ public static final String reserveIdStrPrefix = "reservation_";
+ protected long clusterTimestamp;
+ protected long id;
+
+ @Private
+ @Unstable
+ public static ReservationId newInstance(long clusterTimestamp, long id) {
+ ReservationId reservationId = Records.newRecord(ReservationId.class);
+ reservationId.setClusterTimestamp(clusterTimestamp);
+ reservationId.setId(id);
+ reservationId.build();
+ return reservationId;
+ }
+
+ /**
+ * Get the long identifier of the {@link ReservationId} which is unique for
+ * all Reservations started by a particular instance of the
+ * {@link ResourceManager}.
+ *
+ * @return long identifier of the {@link ReservationId}
+ */
+ @Public
+ @Unstable
+ public abstract long getId();
+
+ @Private
+ @Unstable
+ protected abstract void setId(long id);
+
+ /**
+ * Get the <em>start time</em> of the {@link ResourceManager} which is used to
+ * generate globally unique {@link ReservationId}.
+ *
+ * @return <em>start time</em> of the {@link ResourceManager}
+ */
+ @Public
+ @Unstable
+ public abstract long getClusterTimestamp();
+
+ @Private
+ @Unstable
+ protected abstract void setClusterTimestamp(long clusterTimestamp);
+
+ protected abstract void build();
+
+ static final ThreadLocal<NumberFormat> reservIdFormat =
+ new ThreadLocal<NumberFormat>() {
+ @Override
+ public NumberFormat initialValue() {
+ NumberFormat fmt = NumberFormat.getInstance();
+ fmt.setGroupingUsed(false);
+ fmt.setMinimumIntegerDigits(4);
+ return fmt;
+ }
+ };
+
+ @Override
+ public int compareTo(ReservationId other) {
+ if (this.getClusterTimestamp() - other.getClusterTimestamp() == 0) {
+ return getId() > getId() ? 1 : getId() < getId() ? -1 : 0;
+ } else {
+ return this.getClusterTimestamp() > other.getClusterTimestamp() ? 1
+ : this.getClusterTimestamp() < other.getClusterTimestamp() ? -1 : 0;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return reserveIdStrPrefix + this.getClusterTimestamp() + "_"
+ + reservIdFormat.get().format(getId());
+ }
+
+ @Override
+ public int hashCode() {
+ // generated by eclipse
+ final int prime = 31;
+ int result = 1;
+ result =
+ prime * result
+ + (int) (getClusterTimestamp() ^ (getClusterTimestamp() >>> 32));
+ result = prime * result + (int) (getId() ^ (getId() >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ // generated by eclipse
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ReservationId other = (ReservationId) obj;
+ if (getClusterTimestamp() != other.getClusterTimestamp())
+ return false;
+ if (getId() != other.getId())
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequest.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequest.java
new file mode 100644
index 0000000..ded6d06
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequest.java
@@ -0,0 +1,222 @@
+/**
+ * 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.api.records;
+
+import java.io.Serializable;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * <p>
+ * {@link ReservationRequest} represents the request made by an application to
+ * the {@link ResourceManager} to reserve {@link Resource}s.
+ * </p>
+ *
+ * <p>
+ * It includes:
+ * <ul>
+ * <li>{@link Resource} required for each request.</li>
+ * <li>
+ * Number of containers, of above specifications, which are required by the
+ * application.</li>
+ * <li>
+ * Concurrency that indicates the gang size of the request.</li>
+ * </ul>
+ * </p>
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationRequest implements
+ Comparable<ReservationRequest> {
+
+ @Public
+ @Unstable
+ public static ReservationRequest newInstance(Resource capability,
+ int numContainers) {
+ return newInstance(capability, numContainers, 1, -1);
+ }
+
+ @Public
+ @Unstable
+ public static ReservationRequest newInstance(Resource capability,
+ int numContainers, int concurrency, long duration) {
+ ReservationRequest request = Records.newRecord(ReservationRequest.class);
+ request.setCapability(capability);
+ request.setNumContainers(numContainers);
+ request.setConcurrency(concurrency);
+ request.setDuration(duration);
+ return request;
+ }
+
+ @Public
+ @Unstable
+ public static class ReservationRequestComparator implements
+ java.util.Comparator<ReservationRequest>, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public int compare(ReservationRequest r1, ReservationRequest r2) {
+ // Compare numContainers, concurrency and capability
+ int ret = r1.getNumContainers() - r2.getNumContainers();
+ if (ret == 0) {
+ ret = r1.getConcurrency() - r2.getConcurrency();
+ }
+ if (ret == 0) {
+ ret = r1.getCapability().compareTo(r2.getCapability());
+ }
+ return ret;
+ }
+ }
+
+ /**
+ * Get the {@link Resource} capability of the request.
+ *
+ * @return {@link Resource} capability of the request
+ */
+ @Public
+ @Unstable
+ public abstract Resource getCapability();
+
+ /**
+ * Set the {@link Resource} capability of the request
+ *
+ * @param capability {@link Resource} capability of the request
+ */
+ @Public
+ @Unstable
+ public abstract void setCapability(Resource capability);
+
+ /**
+ * Get the number of containers required with the given specifications.
+ *
+ * @return number of containers required with the given specifications
+ */
+ @Public
+ @Unstable
+ public abstract int getNumContainers();
+
+ /**
+ * Set the number of containers required with the given specifications
+ *
+ * @param numContainers number of containers required with the given
+ * specifications
+ */
+ @Public
+ @Unstable
+ public abstract void setNumContainers(int numContainers);
+
+ /**
+ * Get the number of containers that need to be scheduled concurrently. The
+ * default value of 1 would fall back to the current non concurrency
+ * constraints on the scheduling behavior.
+ *
+ * @return the number of containers to be concurrently scheduled
+ */
+ @Public
+ @Unstable
+ public abstract int getConcurrency();
+
+ /**
+ * Set the number of containers that need to be scheduled concurrently. The
+ * default value of 1 would fall back to the current non concurrency
+ * constraints on the scheduling behavior.
+ *
+ * @param numContainers the number of containers to be concurrently scheduled
+ */
+ @Public
+ @Unstable
+ public abstract void setConcurrency(int numContainers);
+
+ /**
+ * Get the duration in milliseconds for which the resource is required. A
+ * default value of -1, indicates an unspecified lease duration, and fallback
+ * to current behavior.
+ *
+ * @return the duration in milliseconds for which the resource is required
+ */
+ @Public
+ @Unstable
+ public abstract long getDuration();
+
+ /**
+ * Set the duration in milliseconds for which the resource is required.
+ *
+ * @param duration the duration in milliseconds for which the resource is
+ * required
+ */
+ @Public
+ @Unstable
+ public abstract void setDuration(long duration);
+
+ @Override
+ public int hashCode() {
+ final int prime = 2153;
+ int result = 2459;
+ Resource capability = getCapability();
+ result =
+ prime * result + ((capability == null) ? 0 : capability.hashCode());
+ result = prime * result + getNumContainers();
+ result = prime * result + getConcurrency();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ReservationRequest other = (ReservationRequest) obj;
+ Resource capability = getCapability();
+ if (capability == null) {
+ if (other.getCapability() != null)
+ return false;
+ } else if (!capability.equals(other.getCapability()))
+ return false;
+ if (getNumContainers() != other.getNumContainers())
+ return false;
+ if (getConcurrency() != other.getConcurrency())
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ReservationRequest other) {
+ int numContainersComparison =
+ this.getNumContainers() - other.getNumContainers();
+ if (numContainersComparison == 0) {
+ int concurrencyComparison =
+ this.getConcurrency() - other.getConcurrency();
+ if (concurrencyComparison == 0) {
+ return this.getCapability().compareTo(other.getCapability());
+ } else {
+ return concurrencyComparison;
+ }
+ } else {
+ return numContainersComparison;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequestInterpreter.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequestInterpreter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequestInterpreter.java
new file mode 100644
index 0000000..4621e0d
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequestInterpreter.java
@@ -0,0 +1,101 @@
+package org.apache.hadoop.yarn.api.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Evolving;
+
+/**
+ * Enumeration of various types of dependencies among multiple
+ * {@link ReservationRequests} within one {@link ReservationDefinition} (from
+ * least constraining to most constraining).
+ */
+@Public
+@Evolving
+public enum ReservationRequestInterpreter {
+ /**
+ * Requires that exactly ONE among the {@link ReservationRequest} submitted as
+ * of a {@link ReservationDefinition} is satisfied to satisfy the overall
+ * {@link ReservationDefinition}.
+ *
+ * WHEN TO USE THIS: This is useful when the user have multiple equivalent
+ * ways to run an application, and wants to expose to the ReservationAgent
+ * such flexibility. For example an application could use one <32GB,16core>
+ * container for 10min, or 16 <2GB,1core> containers for 15min, the
+ * ReservationAgent will decide which one of the two it is best for the system
+ * to place.
+ *
+ */
+ R_ANY,
+
+ /**
+ * Requires that ALL of the {@link ReservationRequest} submitted as part of a
+ * {@link ReservationDefinition} are satisfied for the overall
+ * {@link ReservationDefinition} to be satisfied. No constraints are imposed
+ * on the temporal ordering of the allocation used to satisfy the
+ * ResourceRequeusts.
+ *
+ * WHEN TO USE THIS: This is useful to capture a scenario in which the user
+ * cares for multiple ReservationDefinition to be all accepted, or none. For
+ * example, a user might want a reservation R1: with 10 x <8GB,4core> for
+ * 10min, and a reservation R2: with 2 <1GB,1core> for 1h, and only if both
+ * are satisfied the workflow run in this reservation succeeds. The key
+ * differentiator from ALL and ORDER, ORDER_NO_GAP, is that ALL imposes no
+ * restrictions on the relative allocations used to place R1 and R2 above.
+ *
+ */
+ R_ALL,
+
+ /**
+ * Requires that ALL of the {@link ReservationRequest} submitted as part of a
+ * {@link ReservationDefinition} are satisfied for the overall
+ * {@link ReservationDefinition} to be satisfied. Moreover, it imposes a
+ * strict temporal ordering on the allocation used to satisfy the
+ * {@link ReservationRequest}s. The allocations satisfying the
+ * {@link ReservationRequest} in position k must strictly precede the
+ * allocations for the {@link ReservationRequest} at position k+1. No
+ * constraints are imposed on temporal gaps between subsequent allocations
+ * (the last instant of the previous allocation can be an arbitrary long
+ * period of time before the first instant of the subsequent allocation).
+ *
+ * WHEN TO USE THIS: Like ALL this requires all ReservationDefinitions to be
+ * placed, but it also imposes a time ordering on the allocations used. This
+ * is important if the ReservationDefinition(s) are used to describe a
+ * workflow with inherent inter-stage dependencies. For example, a first job
+ * runs in a ReservaitonDefinition R1 (10 x <1GB,1core> for 20min), and its
+ * output is consumed by a second job described by a ReservationDefinition R2
+ * (5 x <1GB,1core>) for 50min). R2 allocation cannot overlap R1, as R2 models
+ * a job depending on the output of the job modeled by R1.
+ */
+ R_ORDER,
+
+ /**
+ * Requires that ALL of the {@link ReservationRequest} submitted as part of a
+ * {@link ReservationDefinition} are satisfied for the overall
+ * {@link ReservationDefinition} to be satisfied. Moreover, it imposes a
+ * strict temporal ordering on the allocation used to satisfy the
+ * {@link ResourceRequeust}s. It imposes a strict temporal ordering on the
+ * allocation used to satisfy the {@link ReservationRequest}s. The allocations
+ * satisfying the {@link ReservationRequest} in position k must strictly
+ * precede the allocations for the {@link ReservationRequest} at position k+1.
+ * Moreover it imposes a "zero-size gap" between subsequent allocations, i.e.,
+ * the last instant in time of the allocations associated with the
+ * {@link ReservationRequest} at position k must be exactly preceding the
+ * first instant in time of the {@link ReservationRequest} at position k+1.
+ * Time ranges are interpreted as [a,b) inclusive left, exclusive right.
+ *
+ * WHEN TO USE THIS: This is a stricter version of R_ORDER, which allows no
+ * gaps between the allocations that satisfy R1 and R2. The use of this is
+ * twofold: 1) prevent long gaps between subsequent stages that produce very
+ * large intermediate output (e.g., the output of R1 is too large to be kept
+ * around for long before the job running in R2 consumes it, and disposes of
+ * it), 2) if the job being modeled has a time-varying resource need, one can
+ * combine multiple ResourceDefinition each approximating a portion of the job
+ * execution (think of using multiple rectangular bounding boxes to described
+ * an arbitrarily shaped area). By asking for no-gaps we guarantee
+ * "continuity" of resources given to this job. This still allow for some
+ * flexibility, as the entire "train" of allocations can be moved rigidly back
+ * or forth within the start-deadline time range (if there is slack).
+ *
+ */
+ R_ORDER_NO_GAP
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequests.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequests.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequests.java
new file mode 100644
index 0000000..8cc3fbc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequests.java
@@ -0,0 +1,94 @@
+/**
+ * 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.api.records;
+
+import java.util.List;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * {@link ReservationRequests} captures the set of resource and constraints the
+ * user cares about regarding a reservation.
+ *
+ * @see ReservationRequest
+ *
+ */
+@Public
+@Unstable
+public abstract class ReservationRequests {
+
+ @Public
+ @Unstable
+ public static ReservationRequests newInstance(
+ List<ReservationRequest> reservationResources,
+ ReservationRequestInterpreter type) {
+ ReservationRequests reservationRequests =
+ Records.newRecord(ReservationRequests.class);
+ reservationRequests.setReservationResources(reservationResources);
+ reservationRequests.setInterpreter(type);
+ return reservationRequests;
+ }
+
+ /**
+ * Get the list of {@link ReservationRequest} representing the resources
+ * required by the application
+ *
+ * @return the list of {@link ReservationRequest}
+ */
+ @Public
+ @Unstable
+ public abstract List<ReservationRequest> getReservationResources();
+
+ /**
+ * Set the list of {@link ReservationRequest} representing the resources
+ * required by the application
+ *
+ * @param resources the list of {@link ReservationRequest}
+ */
+ @Public
+ @Unstable
+ public abstract void setReservationResources(
+ List<ReservationRequest> reservationResources);
+
+ /**
+ * Get the {@link ReservationRequestInterpreter}, representing how the list of
+ * resources should be allocated, this captures temporal ordering and other
+ * constraints.
+ *
+ * @return the list of {@link ReservationRequestInterpreter}
+ */
+ @Public
+ @Unstable
+ public abstract ReservationRequestInterpreter getInterpreter();
+
+ /**
+ * Set the {@link ReservationRequestInterpreter}, representing how the list of
+ * resources should be allocated, this captures temporal ordering and other
+ * constraints.
+ *
+ * @param interpreter the {@link ReservationRequestInterpreter} for this
+ * reservation
+ */
+ @Public
+ @Unstable
+ public abstract void setInterpreter(ReservationRequestInterpreter interpreter);
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto
index 2d8cae6..3346aef 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto
@@ -49,5 +49,8 @@ service ApplicationClientProtocolService {
rpc getApplicationAttempts (GetApplicationAttemptsRequestProto) returns (GetApplicationAttemptsResponseProto);
rpc getContainerReport (GetContainerReportRequestProto) returns (GetContainerReportResponseProto);
rpc getContainers (GetContainersRequestProto) returns (GetContainersResponseProto);
+ rpc submitReservation (ReservationSubmissionRequestProto) returns (ReservationSubmissionResponseProto);
+ rpc updateReservation (ReservationUpdateRequestProto) returns (ReservationUpdateResponseProto);
+ rpc deleteReservation (ReservationDeleteRequestProto) returns (ReservationDeleteResponseProto);
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
index b368746..c645719 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
@@ -202,7 +202,6 @@ message ApplicationAttemptReportProto {
optional string diagnostics = 5 [default = "N/A"];
optional YarnApplicationAttemptStateProto yarn_application_attempt_state = 6;
optional ContainerIdProto am_container_id = 7;
- optional string original_tracking_url = 8;
}
enum NodeStateProto {
@@ -293,6 +292,7 @@ message ApplicationSubmissionContextProto {
repeated string applicationTags = 12;
optional int64 attempt_failures_validity_interval = 13 [default = -1];
optional LogAggregationContextProto log_aggregation_context = 14;
+ optional ReservationIdProto reservation_id = 15;
}
message LogAggregationContextProto {
@@ -341,6 +341,41 @@ message QueueUserACLInfoProto {
}
////////////////////////////////////////////////////////////////////////
+////// From reservation_protocol /////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+message ReservationIdProto {
+ optional int64 id = 1;
+ optional int64 cluster_timestamp = 2;
+}
+
+message ReservationRequestProto {
+ optional ResourceProto capability = 1;
+ optional int32 num_containers = 2 [default = 1];
+ optional int32 concurrency = 3 [default = 1];
+ optional int64 duration = 4 [default = -1];
+}
+
+message ReservationRequestsProto {
+ repeated ReservationRequestProto reservation_resources = 1;
+ optional ReservationRequestInterpreterProto interpreter = 2 [default = R_ALL];
+}
+
+message ReservationDefinitionProto {
+ optional ReservationRequestsProto reservation_requests = 1;
+ optional int64 arrival = 2;
+ optional int64 deadline = 3;
+ optional string reservation_name = 4;
+}
+
+enum ReservationRequestInterpreterProto {
+ R_ANY = 0;
+ R_ALL = 1;
+ R_ORDER = 2;
+ R_ORDER_NO_GAP = 3;
+ }
+
+////////////////////////////////////////////////////////////////////////
////// From container_manager //////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
index 4203744..2585f78 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
@@ -292,3 +292,31 @@ message GetContainersRequestProto {
message GetContainersResponseProto {
repeated ContainerReportProto containers = 1;
}
+
+//////////////////////////////////////////////////////
+// reservation_protocol
+//////////////////////////////////////////////////////
+
+message ReservationSubmissionRequestProto {
+ optional string queue = 1;
+ optional ReservationDefinitionProto reservation_definition = 2;
+}
+
+message ReservationSubmissionResponseProto {
+ optional ReservationIdProto reservation_id = 1;
+}
+
+message ReservationUpdateRequestProto {
+ optional ReservationDefinitionProto reservation_definition = 1;
+ optional ReservationIdProto reservation_id = 2;
+}
+
+message ReservationUpdateResponseProto {
+}
+
+message ReservationDeleteRequestProto {
+ optional ReservationIdProto reservation_id = 1;
+}
+
+message ReservationDeleteResponseProto {
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java
index 5794da0..b4b9f43 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java
@@ -63,6 +63,12 @@ import org.apache.hadoop.yarn.api.protocolrecords.MoveApplicationAcrossQueuesReq
import org.apache.hadoop.yarn.api.protocolrecords.MoveApplicationAcrossQueuesResponse;
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest;
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse;
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.CancelDelegationTokenRequestPBImpl;
@@ -97,6 +103,12 @@ import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.MoveApplicationAcrossQ
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.MoveApplicationAcrossQueuesResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RenewDelegationTokenRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RenewDelegationTokenResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationDeleteRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationDeleteResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationUpdateRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationUpdateResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationResponsePBImpl;
import org.apache.hadoop.yarn.exceptions.YarnException;
@@ -110,13 +122,15 @@ import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueInfoRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetQueueUserAclsInfoRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.KillApplicationRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.MoveApplicationAcrossQueuesRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationSubmissionRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationUpdateRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationDeleteRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptsRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptReportRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerReportRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainersRequestProto;
-
import com.google.protobuf.ServiceException;
@Private
@@ -391,4 +405,46 @@ public class ApplicationClientProtocolPBClientImpl implements ApplicationClientP
}
}
+ @Override
+ public ReservationSubmissionResponse submitReservation(ReservationSubmissionRequest request)
+ throws YarnException, IOException {
+ ReservationSubmissionRequestProto requestProto =
+ ((ReservationSubmissionRequestPBImpl) request).getProto();
+ try {
+ return new ReservationSubmissionResponsePBImpl(proxy.submitReservation(null,
+ requestProto));
+ } catch (ServiceException e) {
+ RPCUtil.unwrapAndThrowException(e);
+ return null;
+ }
+ }
+
+ @Override
+ public ReservationUpdateResponse updateReservation(ReservationUpdateRequest request)
+ throws YarnException, IOException {
+ ReservationUpdateRequestProto requestProto =
+ ((ReservationUpdateRequestPBImpl) request).getProto();
+ try {
+ return new ReservationUpdateResponsePBImpl(proxy.updateReservation(null,
+ requestProto));
+ } catch (ServiceException e) {
+ RPCUtil.unwrapAndThrowException(e);
+ return null;
+ }
+ }
+
+ @Override
+ public ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request)
+ throws YarnException, IOException {
+ ReservationDeleteRequestProto requestProto =
+ ((ReservationDeleteRequestPBImpl) request).getProto();
+ try {
+ return new ReservationDeleteResponsePBImpl(proxy.deleteReservation(null,
+ requestProto));
+ } catch (ServiceException e) {
+ RPCUtil.unwrapAndThrowException(e);
+ return null;
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java
index 1d9bedd..f73202d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java
@@ -45,6 +45,9 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetQueueUserAclsInfoResponse;
import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse;
import org.apache.hadoop.yarn.api.protocolrecords.MoveApplicationAcrossQueuesResponse;
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse;
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.CancelDelegationTokenRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.CancelDelegationTokenResponsePBImpl;
@@ -78,6 +81,12 @@ import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.MoveApplicationAcrossQ
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.MoveApplicationAcrossQueuesResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RenewDelegationTokenRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RenewDelegationTokenResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationDeleteRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationDeleteResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationSubmissionResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationUpdateRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationUpdateResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationResponsePBImpl;
import org.apache.hadoop.yarn.exceptions.YarnException;
@@ -99,6 +108,12 @@ import org.apache.hadoop.yarn.proto.YarnServiceProtos.KillApplicationRequestProt
import org.apache.hadoop.yarn.proto.YarnServiceProtos.KillApplicationResponseProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.MoveApplicationAcrossQueuesRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.MoveApplicationAcrossQueuesResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationSubmissionRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationSubmissionResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationUpdateRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationUpdateResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationDeleteRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationDeleteResponseProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationResponseProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptReportRequestProto;
@@ -383,4 +398,50 @@ public class ApplicationClientProtocolPBServiceImpl implements ApplicationClient
throw new ServiceException(e);
}
}
+
+ @Override
+ public ReservationSubmissionResponseProto submitReservation(RpcController controller,
+ ReservationSubmissionRequestProto requestProto) throws ServiceException {
+ ReservationSubmissionRequestPBImpl request =
+ new ReservationSubmissionRequestPBImpl(requestProto);
+ try {
+ ReservationSubmissionResponse response = real.submitReservation(request);
+ return ((ReservationSubmissionResponsePBImpl) response).getProto();
+ } catch (YarnException e) {
+ throw new ServiceException(e);
+ } catch (IOException e) {
+ throw new ServiceException(e);
+ }
+ }
+
+ @Override
+ public ReservationUpdateResponseProto updateReservation(RpcController controller,
+ ReservationUpdateRequestProto requestProto) throws ServiceException {
+ ReservationUpdateRequestPBImpl request =
+ new ReservationUpdateRequestPBImpl(requestProto);
+ try {
+ ReservationUpdateResponse response = real.updateReservation(request);
+ return ((ReservationUpdateResponsePBImpl) response).getProto();
+ } catch (YarnException e) {
+ throw new ServiceException(e);
+ } catch (IOException e) {
+ throw new ServiceException(e);
+ }
+ }
+
+ @Override
+ public ReservationDeleteResponseProto deleteReservation(RpcController controller,
+ ReservationDeleteRequestProto requestProto) throws ServiceException {
+ ReservationDeleteRequestPBImpl request =
+ new ReservationDeleteRequestPBImpl(requestProto);
+ try {
+ ReservationDeleteResponse response = real.deleteReservation(request);
+ return ((ReservationDeleteResponsePBImpl) response).getProto();
+ } catch (YarnException e) {
+ throw new ServiceException(e);
+ } catch (IOException e) {
+ throw new ServiceException(e);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/ReservationDeleteRequestPBImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/ReservationDeleteRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/ReservationDeleteRequestPBImpl.java
new file mode 100644
index 0000000..c235dce
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/ReservationDeleteRequestPBImpl.java
@@ -0,0 +1,127 @@
+/**
+ * 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.api.protocolrecords.impl.pb;
+
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest;
+import org.apache.hadoop.yarn.api.records.ReservationId;
+import org.apache.hadoop.yarn.api.records.impl.pb.ReservationIdPBImpl;
+import org.apache.hadoop.yarn.proto.YarnProtos.ReservationIdProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationDeleteRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationDeleteRequestProtoOrBuilder;
+
+import com.google.protobuf.TextFormat;
+
+public class ReservationDeleteRequestPBImpl extends ReservationDeleteRequest {
+
+ ReservationDeleteRequestProto proto = ReservationDeleteRequestProto
+ .getDefaultInstance();
+ ReservationDeleteRequestProto.Builder builder = null;
+ boolean viaProto = false;
+
+ private ReservationId reservationId;
+
+ public ReservationDeleteRequestPBImpl() {
+ builder = ReservationDeleteRequestProto.newBuilder();
+ }
+
+ public ReservationDeleteRequestPBImpl(ReservationDeleteRequestProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ public ReservationDeleteRequestProto getProto() {
+ mergeLocalToProto();
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ private void mergeLocalToBuilder() {
+ if (this.reservationId != null) {
+ builder.setReservationId(convertToProtoFormat(this.reservationId));
+ }
+ }
+
+ private void mergeLocalToProto() {
+ if (viaProto)
+ maybeInitBuilder();
+ mergeLocalToBuilder();
+ proto = builder.build();
+ viaProto = true;
+ }
+
+ private void maybeInitBuilder() {
+ if (viaProto || builder == null) {
+ builder = ReservationDeleteRequestProto.newBuilder(proto);
+ }
+ viaProto = false;
+ }
+
+ @Override
+ public ReservationId getReservationId() {
+ ReservationDeleteRequestProtoOrBuilder p = viaProto ? proto : builder;
+ if (reservationId != null) {
+ return reservationId;
+ }
+ if (!p.hasReservationId()) {
+ return null;
+ }
+ reservationId = convertFromProtoFormat(p.getReservationId());
+ return reservationId;
+ }
+
+ @Override
+ public void setReservationId(ReservationId reservationId) {
+ maybeInitBuilder();
+ if (reservationId == null) {
+ builder.clearReservationId();
+ return;
+ }
+ this.reservationId = reservationId;
+ }
+
+ private ReservationIdPBImpl convertFromProtoFormat(ReservationIdProto p) {
+ return new ReservationIdPBImpl(p);
+ }
+
+ private ReservationIdProto convertToProtoFormat(ReservationId t) {
+ return ((ReservationIdPBImpl) t).getProto();
+ }
+
+ @Override
+ public int hashCode() {
+ return getProto().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (other.getClass().isAssignableFrom(this.getClass())) {
+ return this.getProto().equals(this.getClass().cast(other).getProto());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return TextFormat.shortDebugString(getProto());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9266df4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/ReservationDeleteResponsePBImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/ReservationDeleteResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/ReservationDeleteResponsePBImpl.java
new file mode 100644
index 0000000..a249ab8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/ReservationDeleteResponsePBImpl.java
@@ -0,0 +1,68 @@
+/**
+ * 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.api.protocolrecords.impl.pb;
+
+import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationDeleteResponseProto;
+
+import com.google.protobuf.TextFormat;
+
+public class ReservationDeleteResponsePBImpl extends ReservationDeleteResponse {
+
+ ReservationDeleteResponseProto proto = ReservationDeleteResponseProto
+ .getDefaultInstance();
+ ReservationDeleteResponseProto.Builder builder = null;
+ boolean viaProto = false;
+
+ public ReservationDeleteResponsePBImpl() {
+ builder = ReservationDeleteResponseProto.newBuilder();
+ }
+
+ public ReservationDeleteResponsePBImpl(ReservationDeleteResponseProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ public ReservationDeleteResponseProto getProto() {
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ @Override
+ public int hashCode() {
+ return getProto().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (other.getClass().isAssignableFrom(this.getClass())) {
+ return this.getProto().equals(this.getClass().cast(other).getProto());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return TextFormat.shortDebugString(getProto());
+ }
+
+}