1 /** 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.apache.hadoop.yarn.api.protocolrecords; 20 21 import org.apache.hadoop.classification.InterfaceAudience.Public; 22 import org.apache.hadoop.classification.InterfaceStability.Unstable; 23 import org.apache.hadoop.yarn.api.records.QueueInfo; 24 import org.apache.hadoop.yarn.api.records.ReservationDefinition; 25 import org.apache.hadoop.yarn.util.Records; 26 27 /** 28 * {@link ReservationSubmissionRequest} captures the set of requirements the 29 * user has to create a reservation. 30 * 31 * @see ReservationDefinition 32 * 33 */ 34 @Public 35 @Unstable 36 public abstract class ReservationSubmissionRequest { 37 38 @Public 39 @Unstable newInstance( ReservationDefinition reservationDefinition, String queueName)40 public static ReservationSubmissionRequest newInstance( 41 ReservationDefinition reservationDefinition, String queueName) { 42 ReservationSubmissionRequest request = 43 Records.newRecord(ReservationSubmissionRequest.class); 44 request.setReservationDefinition(reservationDefinition); 45 request.setQueue(queueName); 46 return request; 47 } 48 49 /** 50 * Get the {@link ReservationDefinition} representing the user constraints for 51 * this reservation 52 * 53 * @return the reservation definition representing user constraints 54 */ 55 @Public 56 @Unstable getReservationDefinition()57 public abstract ReservationDefinition getReservationDefinition(); 58 59 /** 60 * Set the {@link ReservationDefinition} representing the user constraints for 61 * this reservation 62 * 63 * @param reservationDefinition the reservation request representing the 64 * reservation 65 */ 66 @Public 67 @Unstable setReservationDefinition( ReservationDefinition reservationDefinition)68 public abstract void setReservationDefinition( 69 ReservationDefinition reservationDefinition); 70 71 /** 72 * Get the name of the {@code Plan} that corresponds to the name of the 73 * {@link QueueInfo} in the scheduler to which the reservation will be 74 * submitted to. 75 * 76 * @return the name of the {@code Plan} that corresponds to the name of the 77 * {@link QueueInfo} in the scheduler to which the reservation will be 78 * submitted to 79 */ 80 @Public 81 @Unstable getQueue()82 public abstract String getQueue(); 83 84 /** 85 * Set the name of the {@code Plan} that corresponds to the name of the 86 * {@link QueueInfo} in the scheduler to which the reservation will be 87 * submitted to 88 * 89 * @param queueName the name of the parent {@code Plan} that corresponds to 90 * the name of the {@link QueueInfo} in the scheduler to which the 91 * reservation will be submitted to 92 */ 93 @Public 94 @Unstable setQueue(String queueName)95 public abstract void setQueue(String queueName); 96 97 } 98