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  ResourceRequest getAMContainerResourceRequest()
          Get ResourceRequest of AM container, if this is not null, scheduler will use this to acquire resource for AM container.
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  long getAttemptFailuresValidityInterval()
          Get the attemptFailuresValidityInterval in milliseconds for the application
abstract  boolean getKeepContainersAcrossApplicationAttempts()
          Get the flag which indicates whether to keep containers across application attempts or not.
abstract  LogAggregationContext getLogAggregationContext()
          Get LogAggregationContext of the application
abstract  int getMaxAppAttempts()
           
abstract  String getNodeLabelExpression()
          Get node-label-expression for this app.
abstract  Priority getPriority()
          Get the Priority of the application.
abstract  String getQueue()
          Get the queue to which the application is being submitted.
abstract  ReservationId getReservationID()
          Get the reservation id, that corresponds to a valid resource allocation in the scheduler (between start and end time of the corresponding reservation)
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, ContainerLaunchContext amContainer, boolean isUnmanagedAM, boolean cancelTokensWhenComplete, int maxAppAttempts, String applicationType, boolean keepContainers, String appLabelExpression, ResourceRequest resourceRequest)
           
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)
           
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, LogAggregationContext logAggregationContext)
           
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, long attemptFailuresValidityInterval)
           
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, String appLabelExpression, String amContainerLabelExpression)
           
abstract  void setAMContainerResourceRequest(ResourceRequest request)
          Set ResourceRequest of AM container
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 setAttemptFailuresValidityInterval(long attemptFailuresValidityInterval)
          Set the attemptFailuresValidityInterval in milliseconds for the application
abstract  void setKeepContainersAcrossApplicationAttempts(boolean keepContainers)
          Set the flag which indicates whether to keep containers across application attempts.
abstract  void setLogAggregationContext(LogAggregationContext logAggregationContext)
          Set LogAggregationContext for the application
abstract  void setMaxAppAttempts(int maxAppAttempts)
          Set the number of max attempts of the application to be submitted.
abstract  void setNodeLabelExpression(String nodeLabelExpression)
          Set node-label-expression for this app
abstract  void setQueue(String queue)
          Set the queue to which the application is being submitted
abstract  void setReservationID(ReservationId reservationID)
          Set the reservation id, that correspond to a valid resource allocation in the scheduler (between start and end time of the corresponding reservation)
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,
                                                                                                          String appLabelExpression,
                                                                                                          String amContainerLabelExpression)

newInstance

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)

newInstance

@InterfaceAudience.Public
@InterfaceStability.Stable
public static ApplicationSubmissionContext newInstance(ApplicationId applicationId,
                                                                                                          String applicationName,
                                                                                                          String queue,
                                                                                                          ContainerLaunchContext amContainer,
                                                                                                          boolean isUnmanagedAM,
                                                                                                          boolean cancelTokensWhenComplete,
                                                                                                          int maxAppAttempts,
                                                                                                          String applicationType,
                                                                                                          boolean keepContainers,
                                                                                                          String appLabelExpression,
                                                                                                          ResourceRequest resourceRequest)

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,
                                                                                                          long attemptFailuresValidityInterval)

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,
                                                                                                          LogAggregationContext logAggregationContext)

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
public abstract Resource getResource()
Get the resource required by the ApplicationMaster for this application. Please note this will be DEPRECATED, use getResource in getAMContainerResourceRequest instead.

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

setResource

@InterfaceAudience.Public
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

getNodeLabelExpression

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract String getNodeLabelExpression()
Get node-label-expression for this app. If this is set, all containers of this application without setting node-label-expression in ResurceRequest will get allocated resources on only those nodes that satisfy this node-label-expression. If different node-label-expression of this app and ResourceRequest are set at the same time, the one set in ResourceRequest will be used when allocating container

Returns:
node-label-expression for this app

setNodeLabelExpression

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract void setNodeLabelExpression(String nodeLabelExpression)
Set node-label-expression for this app

Parameters:
nodeLabelExpression - node-label-expression of this app

getAMContainerResourceRequest

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract ResourceRequest getAMContainerResourceRequest()
Get ResourceRequest of AM container, if this is not null, scheduler will use this to acquire resource for AM container. If this is null, scheduler will assemble a ResourceRequest by using getResource and getPriority of ApplicationSubmissionContext. Number of containers and Priority will be ignore.

Returns:
ResourceRequest of AM container

setAMContainerResourceRequest

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract void setAMContainerResourceRequest(ResourceRequest request)
Set ResourceRequest of AM container

Parameters:
request - of AM container

getAttemptFailuresValidityInterval

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract long getAttemptFailuresValidityInterval()
Get the attemptFailuresValidityInterval in milliseconds for the application

Returns:
the attemptFailuresValidityInterval

setAttemptFailuresValidityInterval

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setAttemptFailuresValidityInterval(long attemptFailuresValidityInterval)
Set the attemptFailuresValidityInterval in milliseconds for the application

Parameters:
attemptFailuresValidityInterval -

getLogAggregationContext

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract LogAggregationContext getLogAggregationContext()
Get LogAggregationContext of the application

Returns:
LogAggregationContext of the application

setLogAggregationContext

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract void setLogAggregationContext(LogAggregationContext logAggregationContext)
Set LogAggregationContext for the application

Parameters:
logAggregationContext - for the application

getReservationID

@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract ReservationId getReservationID()
Get the reservation id, that corresponds to a valid resource allocation in the scheduler (between start and end time of the corresponding reservation)

Returns:
the reservation id representing the unique id of the corresponding reserved resource allocation in the scheduler

setReservationID

@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract void setReservationID(ReservationId reservationID)
Set the reservation id, that correspond to a valid resource allocation in the scheduler (between start and end time of the corresponding reservation)

Parameters:
reservationID - representing the unique id of the corresponding reserved resource allocation in the scheduler


Copyright © 2014 Apache Software Foundation. All Rights Reserved.