org.apache.hadoop.yarn.api.records
Class ApplicationSubmissionContext

java.lang.Object
  extended by org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class ApplicationSubmissionContext
extends Object

ApplicationSubmissionContext represents all of the information needed by the ResourceManager to launch the ApplicationMaster for an application.

It includes details such as:

See Also:
ContainerLaunchContext, ApplicationClientProtocol.submitApplication(org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest)

Constructor Summary
ApplicationSubmissionContext()
           
 
Method Summary
abstract  ContainerLaunchContext getAMContainerSpec()
          Get the ContainerLaunchContext to describe the Container with which the ApplicationMaster is launched.
abstract  ApplicationId getApplicationId()
          Get the ApplicationId of the submitted application.
abstract  String getApplicationName()
          Get the application name.
abstract  Set<String> getApplicationTags()
          Get tags for the application
abstract  String getApplicationType()
          Get the application type
abstract  boolean getKeepContainersAcrossApplicationAttempts()
          Get the flag which indicates whether to keep containers across application attempts or not.
abstract  int getMaxAppAttempts()
           
abstract  Priority getPriority()
          Get the Priority of the application.
abstract  String getQueue()
          Get the queue to which the application is being submitted.
abstract  Resource getResource()
          Get the resource required by the ApplicationMaster for this application.
abstract  boolean getUnmanagedAM()
          Get if the RM should manage the execution of the AM.
static ApplicationSubmissionContext newInstance(ApplicationId applicationId, String applicationName, String queue, Priority priority, ContainerLaunchContext amContainer, boolean isUnmanagedAM, boolean cancelTokensWhenComplete, int maxAppAttempts, Resource resource)
           
static ApplicationSubmissionContext newInstance(ApplicationId applicationId, String applicationName, String queue, Priority priority, ContainerLaunchContext amContainer, boolean isUnmanagedAM, boolean cancelTokensWhenComplete, int maxAppAttempts, Resource resource, String applicationType)
           
static ApplicationSubmissionContext newInstance(ApplicationId applicationId, String applicationName, String queue, Priority priority, ContainerLaunchContext amContainer, boolean isUnmanagedAM, boolean cancelTokensWhenComplete, int maxAppAttempts, Resource resource, String applicationType, boolean keepContainers)
           
abstract  void setAMContainerSpec(ContainerLaunchContext amContainer)
          Set the ContainerLaunchContext to describe the Container with which the ApplicationMaster is launched.
abstract  void setApplicationId(ApplicationId applicationId)
          Set the ApplicationId of the submitted application.
abstract  void setApplicationName(String applicationName)
          Set the application name.
abstract  void setApplicationTags(Set<String> tags)
          Set tags for the application.
abstract  void setApplicationType(String applicationType)
          Set the application type
abstract  void setKeepContainersAcrossApplicationAttempts(boolean keepContainers)
          Set the flag which indicates whether to keep containers across application attempts.
abstract  void setMaxAppAttempts(int maxAppAttempts)
          Set the number of max attempts of the application to be submitted.
abstract  void setQueue(String queue)
          Set the queue to which the application is being submitted
abstract  void setResource(Resource resource)
          Set the resource required by the ApplicationMaster for this application.
abstract  void setUnmanagedAM(boolean value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationSubmissionContext

public ApplicationSubmissionContext()
Method Detail

newInstance

@InterfaceAudience.Public
@InterfaceStability.Stable
public static ApplicationSubmissionContext newInstance(ApplicationId applicationId,
                                                                                                          String applicationName,
                                                                                                          String queue,
                                                                                                          Priority priority,
                                                                                                          ContainerLaunchContext amContainer,
                                                                                                          boolean isUnmanagedAM,
                                                                                                          boolean cancelTokensWhenComplete,
                                                                                                          int maxAppAttempts,
                                                                                                          Resource resource,
                                                                                                          String applicationType,
                                                                                                          boolean keepContainers)

newInstance

@InterfaceAudience.Public
@InterfaceStability.Stable
public static ApplicationSubmissionContext newInstance(ApplicationId applicationId,
                                                                                                          String applicationName,
                                                                                                          String queue,
                                                                                                          Priority priority,
                                                                                                          ContainerLaunchContext amContainer,
                                                                                                          boolean isUnmanagedAM,
                                                                                                          boolean cancelTokensWhenComplete,
                                                                                                          int maxAppAttempts,
                                                                                                          Resource resource,
                                                                                                          String applicationType)

newInstance

@InterfaceAudience.Public
@InterfaceStability.Stable
public static ApplicationSubmissionContext newInstance(ApplicationId applicationId,
                                                                                                          String applicationName,
                                                                                                          String queue,
                                                                                                          Priority priority,
                                                                                                          ContainerLaunchContext amContainer,
                                                                                                          boolean isUnmanagedAM,
                                                                                                          boolean cancelTokensWhenComplete,
                                                                                                          int maxAppAttempts,
                                                                                                          Resource resource)

getApplicationId

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract ApplicationId getApplicationId()
Get the ApplicationId of the submitted application.

Returns:
ApplicationId of the submitted application

setApplicationId

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setApplicationId(ApplicationId applicationId)
Set the ApplicationId of the submitted application.

Parameters:
applicationId - ApplicationId of the submitted application

getApplicationName

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract String getApplicationName()
Get the application name.

Returns:
application name

setApplicationName

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setApplicationName(String applicationName)
Set the application name.

Parameters:
applicationName - application name

getQueue

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract String getQueue()
Get the queue to which the application is being submitted.

Returns:
queue to which the application is being submitted

setQueue

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setQueue(String queue)
Set the queue to which the application is being submitted

Parameters:
queue - queue to which the application is being submitted

getPriority

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract Priority getPriority()
Get the Priority of the application.

Returns:
Priority of the application

getAMContainerSpec

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract ContainerLaunchContext getAMContainerSpec()
Get the ContainerLaunchContext to describe the Container with which the ApplicationMaster is launched.

Returns:
ContainerLaunchContext for the ApplicationMaster container

setAMContainerSpec

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setAMContainerSpec(ContainerLaunchContext amContainer)
Set the ContainerLaunchContext to describe the Container with which the ApplicationMaster is launched.

Parameters:
amContainer - ContainerLaunchContext for the ApplicationMaster container

getUnmanagedAM

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract boolean getUnmanagedAM()
Get if the RM should manage the execution of the AM. If true, then the RM will not allocate a container for the AM and start it. It will expect the AM to be launched and connect to the RM within the AM liveliness period and fail the app otherwise. The client should launch the AM only after the RM has ACCEPTED the application and changed the YarnApplicationState. Such apps will not be retried by the RM on app attempt failure. The default value is false.

Returns:
true if the AM is not managed by the RM

setUnmanagedAM

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setUnmanagedAM(boolean value)
Parameters:
value - true if RM should not manage the AM

getMaxAppAttempts

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract int getMaxAppAttempts()
Returns:
the number of max attempts of the application to be submitted

setMaxAppAttempts

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setMaxAppAttempts(int maxAppAttempts)
Set the number of max attempts of the application to be submitted. WARNING: it should be no larger than the global number of max attempts in the Yarn configuration.

Parameters:
maxAppAttempts - the number of max attempts of the application to be submitted.

getResource

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract Resource getResource()
Get the resource required by the ApplicationMaster for this application.

Returns:
the resource required by the ApplicationMaster for this application.

setResource

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setResource(Resource resource)
Set the resource required by the ApplicationMaster for this application.

Parameters:
resource - the resource required by the ApplicationMaster for this application.

getApplicationType

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract String getApplicationType()
Get the application type

Returns:
the application type

setApplicationType

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setApplicationType(String applicationType)
Set the application type

Parameters:
applicationType - the application type

getKeepContainersAcrossApplicationAttempts

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract boolean getKeepContainersAcrossApplicationAttempts()
Get the flag which indicates whether to keep containers across application attempts or not.

Returns:
the flag which indicates whether to keep containers across application attempts or not.

setKeepContainersAcrossApplicationAttempts

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setKeepContainersAcrossApplicationAttempts(boolean keepContainers)
Set the flag which indicates whether to keep containers across application attempts.

If the flag is true, running containers will not be killed when application attempt fails and these containers will be retrieved by the new application attempt on registration via ApplicationMasterProtocol.registerApplicationMaster(RegisterApplicationMasterRequest).

Parameters:
keepContainers - the flag which indicates whether to keep containers across application attempts.

getApplicationTags

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract Set<String> getApplicationTags()
Get tags for the application

Returns:
the application tags

setApplicationTags

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setApplicationTags(Set<String> tags)
Set tags for the application. A maximum of YarnConfiguration.APPLICATION_MAX_TAGS are allowed per application. Each tag can be at most YarnConfiguration.APPLICATION_MAX_TAG_LENGTH characters, and can contain only ASCII characters.

Parameters:
tags - tags to set


Copyright © 2014 Apache Software Foundation. All Rights Reserved.