001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.apache.hadoop.yarn.api.protocolrecords; 020 021import org.apache.hadoop.classification.InterfaceAudience.Public; 022import org.apache.hadoop.classification.InterfaceStability.Unstable; 023import org.apache.hadoop.yarn.api.records.QueueInfo; 024import org.apache.hadoop.yarn.api.records.ReservationDefinition; 025import org.apache.hadoop.yarn.api.records.ReservationId; 026import org.apache.hadoop.yarn.util.Records; 027 028/** 029 * {@link ReservationSubmissionRequest} captures the set of requirements the 030 * user has to create a reservation. 031 * 032 * @see ReservationDefinition 033 * 034 */ 035@Public 036@Unstable 037public abstract class ReservationSubmissionRequest { 038 039 @Public 040 @Unstable 041 public static ReservationSubmissionRequest newInstance( 042 ReservationDefinition reservationDefinition, String queueName, 043 ReservationId reservationId) { 044 ReservationSubmissionRequest request = 045 Records.newRecord(ReservationSubmissionRequest.class); 046 request.setReservationDefinition(reservationDefinition); 047 request.setQueue(queueName); 048 request.setReservationId(reservationId); 049 return request; 050 } 051 052 /** 053 * Get the {@link ReservationDefinition} representing the user constraints for 054 * this reservation 055 * 056 * @return the reservation definition representing user constraints 057 */ 058 @Public 059 @Unstable 060 public abstract ReservationDefinition getReservationDefinition(); 061 062 /** 063 * Set the {@link ReservationDefinition} representing the user constraints for 064 * this reservation 065 * 066 * @param reservationDefinition the reservation request representing the 067 * reservation 068 */ 069 @Public 070 @Unstable 071 public abstract void setReservationDefinition( 072 ReservationDefinition reservationDefinition); 073 074 /** 075 * Get the name of the {@code Plan} that corresponds to the name of the 076 * {@link QueueInfo} in the scheduler to which the reservation will be 077 * submitted to. 078 * 079 * @return the name of the {@code Plan} that corresponds to the name of the 080 * {@link QueueInfo} in the scheduler to which the reservation will be 081 * submitted to 082 */ 083 @Public 084 @Unstable 085 public abstract String getQueue(); 086 087 /** 088 * Set the name of the {@code Plan} that corresponds to the name of the 089 * {@link QueueInfo} in the scheduler to which the reservation will be 090 * submitted to 091 * 092 * @param queueName the name of the parent {@code Plan} that corresponds to 093 * the name of the {@link QueueInfo} in the scheduler to which the 094 * reservation will be submitted to 095 */ 096 @Public 097 @Unstable 098 public abstract void setQueue(String queueName); 099 100 /** 101 * Get the reservation id that corresponds to the reservation submission. 102 * 103 * @return reservation id that will be used to identify the reservation 104 * submission. 105 */ 106 @Public 107 @Unstable 108 public abstract ReservationId getReservationId(); 109 110 /** 111 * Set the reservation id that corresponds to the reservation submission. 112 * 113 * @param reservationId reservation id that will be used to identify the 114 * reservation submission. 115 */ 116 @Public 117 @Unstable 118 public abstract void setReservationId(ReservationId reservationId); 119 120}