Class ServiceClient

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

@Public @Unstable public class ServiceClient extends org.apache.hadoop.yarn.client.api.AppAdminClient implements SliderExitCodes, YarnServiceConstants
  • Field Details

    • yarnClient

      protected org.apache.hadoop.yarn.client.api.YarnClient yarnClient
  • Constructor Details

    • ServiceClient

      public ServiceClient()
  • Method Details

    • serviceInit

      protected void serviceInit(org.apache.hadoop.conf.Configuration configuration) throws Exception
      Overrides:
      serviceInit in class org.apache.hadoop.service.CompositeService
      Throws:
      Exception
    • serviceStop

      protected void serviceStop() throws Exception
      Overrides:
      serviceStop in class org.apache.hadoop.service.CompositeService
      Throws:
      Exception
    • loadAppJsonFromLocalFS

      public Service loadAppJsonFromLocalFS(String fileName, String serviceName, Long lifetime, String queue) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionSave

      public int actionSave(String fileName, String serviceName, Long lifetime, String queue) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      actionSave in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionBuild

      public int actionBuild(Service service) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • actionUpgradeExpress

      public int actionUpgradeExpress(String appName, File path) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      actionUpgradeExpress in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionUpgradeExpress

      public int actionUpgradeExpress(Service service) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • initiateUpgrade

      public int initiateUpgrade(String appName, String fileName, boolean autoFinalize) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      initiateUpgrade in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • initiateUpgrade

      public int initiateUpgrade(Service service) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • actionUpgradeInstances

      public int actionUpgradeInstances(String appName, List<String> componentInstances) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      actionUpgradeInstances in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionUpgradeComponents

      public int actionUpgradeComponents(String appName, List<String> components) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      actionUpgradeComponents in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionCancelUpgrade

      public int actionCancelUpgrade(String appName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      actionCancelUpgrade in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionDecommissionInstances

      public int actionDecommissionInstances(String appName, List<String> componentInstances) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      actionDecommissionInstances in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionCleanUp

      public int actionCleanUp(String appName, String userName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      actionCleanUp in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • getInstances

      public String getInstances(String appName, List<String> components, String version, List<String> containerStates) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      getInstances in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • getContainers

      public ComponentContainers[] getContainers(String appName, List<String> components, String version, List<ContainerState> containerStates) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionUpgrade

      public int actionUpgrade(Service service, List<Container> compInstances) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionLaunch

      public int actionLaunch(String fileName, String serviceName, Long lifetime, String queue) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      actionLaunch in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionCreate

      public org.apache.hadoop.yarn.api.records.ApplicationId actionCreate(Service service) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionFlex

      public int actionFlex(String serviceName, Map<String,String> componentCountStrings) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Specified by:
      actionFlex in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • flexByRestService

      public Map<String,Long> flexByRestService(String serviceName, Map<String,Long> componentCounts) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • actionStop

      public int actionStop(String serviceName) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Specified by:
      actionStop in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • actionStop

      public int actionStop(String serviceName, boolean waitForAppStopped) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • actionDestroy

      public int actionDestroy(String serviceName) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Specified by:
      actionDestroy in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • compressFiles

      public static File compressFiles(Collection<File> files, File output, String bundleRoot) throws IOException
      Compress (tar) the input files to the output file.
      Parameters:
      files - The files to compress
      output - The resulting output file (should end in .tar.gz)
      bundleRoot -
      Throws:
      IOException
    • addAMEnv

      @VisibleForTesting protected Map<String,String> addAMEnv() throws IOException
      Throws:
      IOException
    • addJarResource

      protected org.apache.hadoop.fs.Path addJarResource(String serviceName, Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localResources) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionStart

      public int actionStart(String serviceName) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Specified by:
      actionStart in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • actionStartAndGetId

      public org.apache.hadoop.yarn.api.records.ApplicationId actionStartAndGetId(String serviceName) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • updateLifetime

      public String updateLifetime(String serviceName, long lifetime) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException
      IOException
    • convertState

      public ServiceState convertState(org.apache.hadoop.yarn.api.records.YarnApplicationState state)
    • getStatusString

      public String getStatusString(String appIdOrName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      getStatusString in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • getStatus

      public Service getStatus(String serviceName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • getYarnClient

      public org.apache.hadoop.yarn.client.api.YarnClient getYarnClient()
    • enableFastLaunch

      public int enableFastLaunch(String destinationFolder) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Specified by:
      enableFastLaunch in class org.apache.hadoop.yarn.client.api.AppAdminClient
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • actionDependency

      public int actionDependency(String destinationFolder, boolean overwrite)
    • createAMProxy

      protected org.apache.hadoop.yarn.service.ClientAMProtocol createAMProxy(String serviceName, org.apache.hadoop.yarn.api.records.ApplicationReport appReport) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException
    • getAppId

      public org.apache.hadoop.yarn.api.records.ApplicationId getAppId(String serviceName) throws IOException, org.apache.hadoop.yarn.exceptions.YarnException
      Throws:
      IOException
      org.apache.hadoop.yarn.exceptions.YarnException