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
019 package org.apache.hadoop.yarn.api.records;
020
021 import org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate;
022 import org.apache.hadoop.classification.InterfaceAudience.Public;
023 import org.apache.hadoop.classification.InterfaceStability.Stable;
024 import org.apache.hadoop.classification.InterfaceStability.Unstable;
025 import org.apache.hadoop.yarn.api.ClientRMProtocol;
026
027 /**
028 * <p><code>ApplicationSubmissionContext</code> represents all of the
029 * information needed by the <code>ResourceManager</code> to launch
030 * the <code>ApplicationMaster</code> for an application.</p>
031 *
032 * <p>It includes details such as:
033 * <ul>
034 * <li>{@link ApplicationId} of the application.</li>
035 * <li>Application user.</li>
036 * <li>Application name.</li>
037 * <li>{@link Priority} of the application.</li>
038 * <li>
039 * {@link ContainerLaunchContext} of the container in which the
040 * <code>ApplicationMaster</code> is executed.
041 * </li>
042 * </ul>
043 * </p>
044 *
045 * @see ContainerLaunchContext
046 * @see ClientRMProtocol#submitApplication(org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest)
047 */
048 @Public
049 @Stable
050 public interface ApplicationSubmissionContext {
051 /**
052 * Get the <code>ApplicationId</code> of the submitted application.
053 * @return <code>ApplicationId</code> of the submitted application
054 */
055 @Public
056 @Stable
057 public ApplicationId getApplicationId();
058
059 /**
060 * Set the <code>ApplicationId</code> of the submitted application.
061 * @param appplicationId <code>ApplicationId</code> of the submitted
062 * application
063 */
064 @Public
065 @Stable
066 public void setApplicationId(ApplicationId appplicationId);
067
068 /**
069 * Get the application <em>name</em>.
070 * @return application name
071 */
072 @Public
073 @Stable
074 public String getApplicationName();
075
076 /**
077 * Set the application <em>name</em>.
078 * @param applicationName application name
079 */
080 @Public
081 @Stable
082 public void setApplicationName(String applicationName);
083
084 /**
085 * Get the <em>queue</em> to which the application is being submitted.
086 * @return <em>queue</em> to which the application is being submitted
087 */
088 @Public
089 @Stable
090 public String getQueue();
091
092 /**
093 * Set the <em>queue</em> to which the application is being submitted
094 * @param queue <em>queue</em> to which the application is being submitted
095 */
096 @Public
097 @Stable
098 public void setQueue(String queue);
099
100 /**
101 * Get the <code>Priority</code> of the application.
102 * @return <code>Priority</code> of the application
103 */
104 @Public
105 @Stable
106 public Priority getPriority();
107
108 /**
109 * Set the <code>Priority</code> of the application.
110 * @param priority <code>Priority</code> of the application
111 */
112 @Public
113 @Stable
114 public void setPriority(Priority priority);
115
116 /**
117 * Get the <em>user</em> submitting the application.
118 * @return <em>user</em> submitting the application
119 */
120 @Public
121 @Stable
122 public String getUser();
123
124 /**
125 * Set the <em>user</em> submitting the application.
126 * @param user <em>user</em> submitting the application
127 */
128 @Public
129 @Stable
130 public void setUser(String user);
131
132 /**
133 * Get the <code>ContainerLaunchContext</code> to describe the
134 * <code>Container</code> with which the <code>ApplicationMaster</code> is
135 * launched.
136 * @return <code>ContainerLaunchContext</code> for the
137 * <code>ApplicationMaster</code> container
138 */
139 @Public
140 @Stable
141 public ContainerLaunchContext getAMContainerSpec();
142
143 /**
144 * Set the <code>ContainerLaunchContext</code> to describe the
145 * <code>Container</code> with which the <code>ApplicationMaster</code> is
146 * launched.
147 * @param amContainer <code>ContainerLaunchContext</code> for the
148 * <code>ApplicationMaster</code> container
149 */
150 @Public
151 @Stable
152 public void setAMContainerSpec(ContainerLaunchContext amContainer);
153
154 /**
155 * Get if the RM should manage the execution of the AM.
156 * If true, then the RM
157 * will not allocate a container for the AM and start it. It will expect the
158 * AM to be launched and connect to the RM within the AM liveliness period and
159 * fail the app otherwise. The client should launch the AM only after the RM
160 * has ACCEPTED the application and changed the <code>YarnApplicationState</code>.
161 * Such apps will not be retried by the RM on app attempt failure.
162 * The default value is false.
163 * @return true if the AM is not managed by the RM
164 */
165 @Public
166 @Unstable
167 public boolean getUnmanagedAM();
168
169 /**
170 * @param value true if RM should not manage the AM
171 */
172 @Public
173 @Unstable
174 public void setUnmanagedAM(boolean value);
175
176 /**
177 * @return true if tokens should be canceled when the app completes.
178 */
179 @LimitedPrivate("mapreduce")
180 @Unstable
181 public boolean getCancelTokensWhenComplete();
182
183 /**
184 * Set to false if tokens should not be canceled when the app finished else
185 * false. WARNING: this is not recommended unless you want your single job
186 * tokens to be reused by others jobs.
187 * @param cancel true if tokens should be canceled when the app finishes.
188 */
189 @LimitedPrivate("mapreduce")
190 @Unstable
191 public void setCancelTokensWhenComplete(boolean cancel);
192 }