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