|
@@ -22,68 +22,319 @@ import java.nio.ByteBuffer;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import org.apache.hadoop.classification.InterfaceAudience.Private;
|
|
|
+import org.apache.hadoop.classification.InterfaceAudience.Public;
|
|
|
+import org.apache.hadoop.classification.InterfaceStability.Stable;
|
|
|
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
|
|
+import org.apache.hadoop.yarn.api.ClientRMProtocol;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p><code>ApplicationSubmissionContext</code> represents the all of the
|
|
|
+ * information needed by the <code>ResourceManager</code> to launch
|
|
|
+ * the <code>ApplicationMaster</code> for an application.</p>
|
|
|
+ *
|
|
|
+ * <p>It includes details such as:
|
|
|
+ * <ul>
|
|
|
+ * <li>{@link ApplicationId} of the application.</li>
|
|
|
+ * <li>
|
|
|
+ * {@link Resource} necessary to run the <code>ApplicationMaster</code>.
|
|
|
+ * </li>
|
|
|
+ * <li>Application user.</li>
|
|
|
+ * <li>Application name.</li>
|
|
|
+ * <li>{@link Priority} of the application.</li>
|
|
|
+ * <li>Security tokens (if security is enabled).</li>
|
|
|
+ * <li>
|
|
|
+ * {@link LocalResource} necessary for running the
|
|
|
+ * <code>ApplicationMaster</code> container such
|
|
|
+ * as binaries, jar, shared-objects, side-files etc.
|
|
|
+ * </li>
|
|
|
+ * <li>
|
|
|
+ * Environment variables for the launched <code>ApplicationMaster</code>
|
|
|
+ * process.
|
|
|
+ * </li>
|
|
|
+ * <li>Command to launch the <code>ApplicationMaster</code>.</li>
|
|
|
+ * </ul>
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @see ClientRMProtocol#submitApplication(org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest)
|
|
|
+ */
|
|
|
+@Public
|
|
|
+@Stable
|
|
|
public interface ApplicationSubmissionContext {
|
|
|
- public abstract ApplicationId getApplicationId();
|
|
|
- public abstract String getApplicationName();
|
|
|
- public abstract Resource getMasterCapability();
|
|
|
+ /**
|
|
|
+ * Get the <code>ApplicationId</code> of the submitted application.
|
|
|
+ * @return <code>ApplicationId</code> of the submitted application
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public ApplicationId getApplicationId();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set the <code>ApplicationId</code> of the submitted application.
|
|
|
+ * @param appplicationId <code>ApplicationId</code> of the submitted
|
|
|
+ * application
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void setApplicationId(ApplicationId appplicationId);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the application <em>name</em>.
|
|
|
+ * @return application name
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public String getApplicationName();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set the application <em>name</em>.
|
|
|
+ * @param applicationName application name
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void setApplicationName(String applicationName);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the <em>queue</em> to which the application is being submitted.
|
|
|
+ * @return <em>queue</em> to which the application is being submitted
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public String getQueue();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set the <em>queue</em> to which the application is being submitted
|
|
|
+ * @param queue <em>queue</em> to which the application is being submitted
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void setQueue(String queue);
|
|
|
|
|
|
- public abstract Map<String, URL> getAllResources();
|
|
|
- public abstract URL getResource(String key);
|
|
|
+ /**
|
|
|
+ * Get the <code>Priority</code> of the application.
|
|
|
+ * @return <code>Priority</code> of the application
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public Priority getPriority();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set the <code>Priority</code> of the application.
|
|
|
+ * @param priority <code>Priority</code> of the application
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void setPriority(Priority priority);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the <em>user</em> submitting the application.
|
|
|
+ * @return <em>user</em> submitting the application
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public String getUser();
|
|
|
|
|
|
- public abstract Map<String, LocalResource> getAllResourcesTodo();
|
|
|
- public abstract LocalResource getResourceTodo(String key);
|
|
|
+ /**
|
|
|
+ * Set the <em>user</em> submitting the application.
|
|
|
+ * @param user <em>user</em> submitting the application
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void setUser(String user);
|
|
|
|
|
|
- public abstract List<String> getFsTokenList();
|
|
|
- public abstract String getFsToken(int index);
|
|
|
- public abstract int getFsTokenCount();
|
|
|
+ /**
|
|
|
+ * Get the <code>Resource</code> required to run the
|
|
|
+ * <code>ApplicationMaster</code>.
|
|
|
+ * @return <code>Resource</code> required to run the
|
|
|
+ * <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public Resource getMasterCapability();
|
|
|
|
|
|
- public abstract ByteBuffer getFsTokensTodo();
|
|
|
+ /**
|
|
|
+ * Set <code>Resource</code> required to run the
|
|
|
+ * <code>ApplicationMaster</code>.
|
|
|
+ * @param masterCapability <code>Resource</code> required to run the
|
|
|
+ * <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void setMasterCapability(Resource masterCapability);
|
|
|
|
|
|
- public abstract Map<String, String> getAllEnvironment();
|
|
|
- public abstract String getEnvironment(String key);
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public Map<String, URL> getAllResources();
|
|
|
|
|
|
- public abstract List<String> getCommandList();
|
|
|
- public abstract String getCommand(int index);
|
|
|
- public abstract int getCommandCount();
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public URL getResource(String key);
|
|
|
|
|
|
- public abstract String getQueue();
|
|
|
- public abstract Priority getPriority();
|
|
|
- public abstract String getUser();
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void addAllResources(Map<String, URL> resources);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void setResource(String key, URL url);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void removeResource(String key);
|
|
|
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void clearResources();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get all the <code>LocalResource</code> required to run the
|
|
|
+ * <code>ApplicationMaster</code>.
|
|
|
+ * @return <code>LocalResource</code> required to run the
|
|
|
+ * <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public Map<String, LocalResource> getAllResourcesTodo();
|
|
|
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public LocalResource getResourceTodo(String key);
|
|
|
|
|
|
- public abstract void setApplicationId(ApplicationId appplicationId);
|
|
|
- public abstract void setApplicationName(String applicationName);
|
|
|
- public abstract void setMasterCapability(Resource masterCapability);
|
|
|
+ /**
|
|
|
+ * Add all the <code>LocalResource</code> required to run the
|
|
|
+ * <code>ApplicationMaster</code>.
|
|
|
+ * @param resources all <code>LocalResource</code> required to run the
|
|
|
+ * <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void addAllResourcesTodo(Map<String, LocalResource> resources);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void setResourceTodo(String key, LocalResource localResource);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void removeResourceTodo(String key);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void clearResourcesTodo();
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public List<String> getFsTokenList();
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public String getFsToken(int index);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public int getFsTokenCount();
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void addAllFsTokens(List<String> fsTokens);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void addFsToken(String fsToken);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void removeFsToken(int index);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void clearFsTokens();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get <em>file-system tokens</em> for the <code>ApplicationMaster</code>.
|
|
|
+ * @return file-system tokens for the <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public ByteBuffer getFsTokensTodo();
|
|
|
|
|
|
- public abstract void addAllResources(Map<String, URL> resources);
|
|
|
- public abstract void setResource(String key, URL url);
|
|
|
- public abstract void removeResource(String key);
|
|
|
- public abstract void clearResources();
|
|
|
+ /**
|
|
|
+ * Set <em>file-system tokens</em> for the <code>ApplicationMaster</code>.
|
|
|
+ * @param fsTokens file-system tokens for the <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void setFsTokensTodo(ByteBuffer fsTokens);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the <em>environment variables</em> for the
|
|
|
+ * <code>ApplicationMaster</code>.
|
|
|
+ * @return environment variables for the <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public Map<String, String> getAllEnvironment();
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public String getEnvironment(String key);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Add all of the <em>environment variables</em> for the
|
|
|
+ * <code>ApplicationMaster</code>.
|
|
|
+ * @param environment environment variables for the
|
|
|
+ * <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void addAllEnvironment(Map<String, String> environment);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void setEnvironment(String key, String env);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void removeEnvironment(String key);
|
|
|
+
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void clearEnvironment();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get the <em>commands</em> to launch the <code>ApplicationMaster</code>.
|
|
|
+ * @return commands to launch the <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public List<String> getCommandList();
|
|
|
|
|
|
- public abstract void addAllResourcesTodo(Map<String, LocalResource> resourcesTodo);
|
|
|
- public abstract void setResourceTodo(String key, LocalResource localResource);
|
|
|
- public abstract void removeResourceTodo(String key);
|
|
|
- public abstract void clearResourcesTodo();
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public String getCommand(int index);
|
|
|
|
|
|
- public abstract void addAllFsTokens(List<String> fsTokens);
|
|
|
- public abstract void addFsToken(String fsToken);
|
|
|
- public abstract void removeFsToken(int index);
|
|
|
- public abstract void clearFsTokens();
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public int getCommandCount();
|
|
|
|
|
|
- public abstract void setFsTokensTodo(ByteBuffer fsTokensTodo);
|
|
|
+ /**
|
|
|
+ * Add all of the <em>commands</em> to launch the
|
|
|
+ * <code>ApplicationMaster</code>.
|
|
|
+ * @param commands commands to launch the <code>ApplicationMaster</code>
|
|
|
+ */
|
|
|
+ @Public
|
|
|
+ @Stable
|
|
|
+ public void addAllCommands(List<String> commands);
|
|
|
|
|
|
- public abstract void addAllEnvironment(Map<String, String> environment);
|
|
|
- public abstract void setEnvironment(String key, String env);
|
|
|
- public abstract void removeEnvironment(String key);
|
|
|
- public abstract void clearEnvironment();
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void addCommand(String command);
|
|
|
|
|
|
- public abstract void addAllCommands(List<String> commands);
|
|
|
- public abstract void addCommand(String command);
|
|
|
- public abstract void removeCommand(int index);
|
|
|
- public abstract void clearCommands();
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void removeCommand(int index);
|
|
|
|
|
|
- public abstract void setQueue(String queue);
|
|
|
- public abstract void setPriority(Priority priority);
|
|
|
- public abstract void setUser(String user);
|
|
|
+ @Private
|
|
|
+ @Unstable
|
|
|
+ public void clearCommands();
|
|
|
}
|