Package org.apache.slider.client

Examples of org.apache.slider.client.SliderClient


    if (appId != null) {
      ClassLoader currentClassLoader = Thread.currentThread()
          .getContextClassLoader();
      Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
      try {
        SliderClient sliderClient = getSliderClient();
        ApplicationReport yarnApp = sliderClient.getApplicationReport(appId);
        return createSliderAppObject(yarnApp, properties, sliderClient);
      } finally {
        Thread.currentThread().setContextClassLoader(currentClassLoader);
      }
    }
View Full Code Here


   * @return
   */
  protected SliderClient getSliderClient() {
    Configuration sliderClientConfiguration = getSliderClientConfiguration();
    if (sliderClientConfiguration != null) {
      SliderClient client = new SliderClient() {
        @Override
        public String getUsername() throws IOException {
          return "yarn";
        }

        @Override
        protected void serviceInit(Configuration conf) throws Exception {
          super.serviceInit(conf);
          // Override the default FS client to set the super user.
          FileSystem fs = FileSystem.get(FileSystem.getDefaultUri(getConfig()),
                                         getConfig(), "yarn");
          SliderFileSystem fileSystem = new SliderFileSystem(fs, getConfig());
          Field fsField = SliderClient.class
              .getDeclaredField("sliderFileSystem");
          fsField.setAccessible(true);
          fsField.set(this, fileSystem);
        }
      };
      try {
        sliderClientConfiguration = client.bindArgs(sliderClientConfiguration,
                                                    new String[]{"usage"});
      } catch (Exception e) {
        logger.warn("Unable to set SliderClient configs", e);
        throw new RuntimeException(e.getMessage(), e);
      }
      client.init(sliderClientConfiguration);
      client.start();
      return client;
    }
    return null;
  }
View Full Code Here

    ClassLoader currentClassLoader = Thread.currentThread()
        .getContextClassLoader();
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
    try {
      Map<String, SliderApp> sliderAppsMap = new HashMap<String, SliderApp>();
      SliderClient sliderClient = getSliderClient();
      List<ApplicationReport> yarnApps = sliderClient.listSliderInstances(null);
      for (ApplicationReport yarnApp : yarnApps) {
        SliderApp sliderAppObject = createSliderAppObject(yarnApp, properties,
                                                          sliderClient);
        if (sliderAppObject != null) {
          if (sliderAppsMap.containsKey(sliderAppObject.getName())) {
View Full Code Here

      SliderApp sliderApp = getSliderApp(applicationId, properties);
      if (sliderApp == null) {
        throw new ApplicationNotFoundException(applicationId);
      }

      SliderClient sliderClient = getSliderClient();
      sliderClient.actionDestroy(sliderApp.getName());
    } finally {
      Thread.currentThread().setContextClassLoader(currentClassLoader);
    }
  }
View Full Code Here

      Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
      try {
        ApplicationId applicationId = UserGroupInformation.getBestUGI(null,
                                                                      "yarn").doAs(new PrivilegedExceptionAction<ApplicationId>() {
          public ApplicationId run() throws IOException, YarnException {
            SliderClient sliderClient = getSliderClient();
            sliderClient.actionCreate(appName, createArgs);
            return sliderClient.applicationId;
          }
        });
        if (applicationId != null) {
          return getApplicationIdString(applicationId);
View Full Code Here

        throw new ApplicationNotFoundException(appId);

      ApplicationId applicationId = UserGroupInformation.getBestUGI(null,
          "yarn").doAs(new PrivilegedExceptionAction<ApplicationId>() {
        public ApplicationId run() throws IOException, YarnException {
          SliderClient sliderClient = getSliderClient();
          ActionFreezeArgs freezeArgs = new ActionFreezeArgs();
          sliderClient.actionFreeze(sliderApp.getName(), freezeArgs);
          return sliderClient.applicationId;
        }
      });
      logger.debug("Slider app has been frozen - " + applicationId.toString());
    } finally {
View Full Code Here

      if (sliderApp == null)
        throw new ApplicationNotFoundException(appId);
      ApplicationId applicationId = UserGroupInformation.getBestUGI(null,
          "yarn").doAs(new PrivilegedExceptionAction<ApplicationId>() {
        public ApplicationId run() throws IOException, YarnException {
          SliderClient sliderClient = getSliderClient();
          ActionThawArgs thawArgs = new ActionThawArgs();
          sliderClient.actionThaw(sliderApp.getName(), thawArgs);
          return sliderClient.applicationId;
        }
      });
      logger.debug("Slider app has been thawed - " + applicationId.toString());
    } finally {
View Full Code Here

TOP

Related Classes of org.apache.slider.client.SliderClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.