Class AppAdminClient

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.service.CompositeService
org.apache.hadoop.yarn.client.api.AppAdminClient
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.service.Service

@Public @Unstable public abstract class AppAdminClient extends org.apache.hadoop.service.CompositeService
Client for managing applications.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.hadoop.service.CompositeService

    org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHook

    Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service

    org.apache.hadoop.service.Service.STATE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     

    Fields inherited from class org.apache.hadoop.service.CompositeService

    STOP_ONLY_STARTED_SERVICES
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract int
    Cancels the upgrade of the service.
    abstract int
    actionCleanUp(String appName, String userName)
    Operation to be performed by the RM after an application has completed.
    abstract int
    actionDecommissionInstances(String appName, List<String> componentInstances)
    Decommission component instances of a long running service.
    abstract int
    Remove the specification and all application data for a YARN application.
    abstract int
    actionFlex(String appName, Map<String,String> componentCounts)
    Change the number of running containers for a component of a YARN application / long-running service.
    abstract int
    actionLaunch(String fileName, String appName, Long lifetime, String queue)
    Launch a new YARN application.
    abstract int
    actionSave(String fileName, String appName, Long lifetime, String queue)
    Save the specification for a YARN application / long-running service.
    abstract int
    Start a YARN application from a previously saved specification.
    abstract int
    actionStop(String appName)
    Stop a YARN application (attempt to stop gracefully before killing the application).
    abstract int
    actionUpgradeComponents(String appName, List<String> components)
    Upgrade components of a long running service.
    abstract int
    actionUpgradeExpress(String appName, File fileName)
    Express upgrade a long running service.
    abstract int
    actionUpgradeInstances(String appName, List<String> componentInstances)
    Upgrade component instances of a long running service.
    createAppAdminClient(String appType, org.apache.hadoop.conf.Configuration conf)
    Create a new instance of AppAdminClient.
    abstract int
    enableFastLaunch(String destinationFolder)
    Upload AM dependencies to HDFS.
    abstract String
    getInstances(String appName, List<String> components, String version, List<String> containerStates)
     
    abstract String
    getStatusString(String appIdOrName)
    Get detailed app specific status string for a YARN application.
    abstract int
    initiateUpgrade(String appName, String fileName, boolean autoFinalize)
    Initiate upgrade of a long running service.

    Methods inherited from class org.apache.hadoop.service.CompositeService

    addIfService, addService, getServices, removeService, serviceInit, serviceStart, serviceStop

    Methods inherited from class org.apache.hadoop.service.AbstractService

    close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • AppAdminClient

      @Private protected AppAdminClient()
  • Method Details

    • createAppAdminClient

      @Public @Unstable public static AppAdminClient createAppAdminClient(String appType, org.apache.hadoop.conf.Configuration conf)

      Create a new instance of AppAdminClient.

      Parameters:
      appType - application type
      conf - configuration
      Returns:
      app admin client
    • actionLaunch

      @Public @Unstable public abstract int actionLaunch(String fileName, String appName, Long lifetime, String queue) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException

      Launch a new YARN application.

      Parameters:
      fileName - specification of application
      appName - name of the application
      lifetime - lifetime of the application
      queue - queue of the application
      Returns:
      exit code
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • actionStop

      @Public @Unstable public abstract int actionStop(String appName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException

      Stop a YARN application (attempt to stop gracefully before killing the application). In the case of a long-running service, the service may be restarted later.

      Parameters:
      appName - the name of the application
      Returns:
      exit code
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • actionStart

      @Public @Unstable public abstract int actionStart(String appName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException

      Start a YARN application from a previously saved specification. In the case of a long-running service, the service must have been previously launched/started and then stopped, or previously saved but not started.

      Parameters:
      appName - the name of the application
      Returns:
      exit code
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • actionSave

      @Public @Unstable public abstract int actionSave(String fileName, String appName, Long lifetime, String queue) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException

      Save the specification for a YARN application / long-running service. The application may be started later.

      Parameters:
      fileName - specification of application to save
      appName - name of the application
      lifetime - lifetime of the application
      queue - queue of the application
      Returns:
      exit code
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • actionDestroy

      @Public @Unstable public abstract int actionDestroy(String appName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException

      Remove the specification and all application data for a YARN application. The application cannot be running.

      Parameters:
      appName - the name of the application
      Returns:
      exit code
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • actionFlex

      @Public @Unstable public abstract int actionFlex(String appName, Map<String,String> componentCounts) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException

      Change the number of running containers for a component of a YARN application / long-running service.

      Parameters:
      appName - the name of the application
      componentCounts - map of component name to new component count or amount to change existing component count (e.g. 5, +5, -5)
      Returns:
      exit code
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • enableFastLaunch

      @Public @Unstable public abstract int enableFastLaunch(String destinationFolder) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException

      Upload AM dependencies to HDFS. This makes future application launches faster since the dependencies do not have to be uploaded on each launch.

      Parameters:
      destinationFolder - an optional HDFS folder where dependency tarball will be uploaded
      Returns:
      exit code
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • getStatusString

      @Public @Unstable public abstract String getStatusString(String appIdOrName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException

      Get detailed app specific status string for a YARN application.

      Parameters:
      appIdOrName - appId or appName
      Returns:
      status string
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • initiateUpgrade

      @Public @Unstable public abstract int initiateUpgrade(String appName, String fileName, boolean autoFinalize) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Initiate upgrade of a long running service.
      Parameters:
      appName - the name of the application.
      fileName - specification of application upgrade to save.
      autoFinalize - when true, finalization of upgrade will be done automatically.
      Returns:
      exit code
      Throws:
      IOException - IOException
      org.apache.hadoop.yarn.exceptions.YarnException - exception in client or server
    • actionUpgradeInstances

      @Public @Unstable public abstract int actionUpgradeInstances(String appName, List<String> componentInstances) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Upgrade component instances of a long running service.
      Parameters:
      appName - the name of the application.
      componentInstances - the name of the component instances.
      Returns:
      exit code.
      Throws:
      IOException - io error occur.
      org.apache.hadoop.yarn.exceptions.YarnException - exceptions from yarn servers.
    • actionUpgradeComponents

      @Public @Unstable public abstract int actionUpgradeComponents(String appName, List<String> components) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Upgrade components of a long running service.
      Parameters:
      appName - the name of the application.
      components - the name of the components.
      Returns:
      exit code.
      Throws:
      IOException - io error occur.
      org.apache.hadoop.yarn.exceptions.YarnException - exceptions from yarn servers.
    • actionCleanUp

      @Public @Unstable public abstract int actionCleanUp(String appName, String userName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException, InterruptedException
      Operation to be performed by the RM after an application has completed.
      Parameters:
      appName - the name of the application.
      userName - the name of the user.
      Returns:
      exit code
      Throws:
      IOException - io error occur.
      org.apache.hadoop.yarn.exceptions.YarnException - exceptions from yarn servers.
      InterruptedException - if interrupted.
    • getInstances

      @Public @Unstable public abstract String getInstances(String appName, List<String> components, String version, List<String> containerStates) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionUpgradeExpress

      @Public @Unstable public abstract int actionUpgradeExpress(String appName, File fileName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Express upgrade a long running service.
      Parameters:
      appName - the name of the application
      fileName - specification of application upgrade to save.
      Returns:
      exit code
      Throws:
      IOException - io error occur.
      org.apache.hadoop.yarn.exceptions.YarnException - exceptions from yarn servers.
    • actionCancelUpgrade

      @Public @Unstable public abstract int actionCancelUpgrade(String appName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Cancels the upgrade of the service.
      Parameters:
      appName - the name of the application
      Returns:
      exit code
      Throws:
      IOException - io error occur.
      org.apache.hadoop.yarn.exceptions.YarnException - exceptions from yarn servers.
    • actionDecommissionInstances

      @Public @Unstable public abstract int actionDecommissionInstances(String appName, List<String> componentInstances) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Decommission component instances of a long running service.
      Parameters:
      appName - the name of the application.
      componentInstances - the name of the component instances.
      Returns:
      exit code.
      Throws:
      IOException - io error occur.
      org.apache.hadoop.yarn.exceptions.YarnException - exceptions from yarn servers.