Example usage for org.apache.hadoop.yarn.exceptions ApplicationNotFoundException ApplicationNotFoundException

List of usage examples for org.apache.hadoop.yarn.exceptions ApplicationNotFoundException ApplicationNotFoundException

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.exceptions ApplicationNotFoundException ApplicationNotFoundException.

Prototype

public ApplicationNotFoundException(String message) 

Source Link

Usage

From source file:org.apache.ambari.view.slider.SliderAppsViewControllerImpl.java

License:Apache License

@Override
public void deleteSliderApp(final String applicationId)
        throws YarnException, IOException, InterruptedException {
    Integer code = invokeSliderClientRunnable(new SliderClientContextRunnable<Integer>() {
        @Override// ww w  . j  a  va  2  s. c  o m
        public Integer run(SliderClient sliderClient) throws YarnException, IOException, InterruptedException {
            Set<String> properties = new HashSet<String>();
            properties.add("id");
            properties.add("name");
            SliderApp sliderApp = getSliderApp(applicationId, properties);
            if (sliderApp == null) {
                throw new ApplicationNotFoundException(applicationId);
            }
            return sliderClient.actionDestroy(sliderApp.getName());
        }
    });
    logger.info("Deleted Slider App [" + applicationId + "] with exit code " + code);
}

From source file:org.apache.ambari.view.slider.SliderAppsViewControllerImpl.java

License:Apache License

@Override
public void freezeApp(final String appId) throws YarnException, IOException, InterruptedException {
    ApplicationId applicationId = invokeSliderClientRunnable(new SliderClientContextRunnable<ApplicationId>() {
        @Override//from ww  w  .j  a v a  2s . c o m
        public ApplicationId run(SliderClient sliderClient)
                throws YarnException, IOException, InterruptedException {
            Set<String> properties = new HashSet<String>();
            properties.add("id");
            properties.add("name");
            final SliderApp sliderApp = getSliderApp(appId, properties);
            if (sliderApp == null)
                throw new ApplicationNotFoundException(appId);
            ActionFreezeArgs freezeArgs = new ActionFreezeArgs();
            sliderClient.actionFreeze(sliderApp.getName(), freezeArgs);
            return sliderClient.applicationId;
        }
    });
    logger.info("Frozen Slider App [" + appId + "] with response: " + applicationId.toString());
}

From source file:org.apache.ambari.view.slider.SliderAppsViewControllerImpl.java

License:Apache License

@Override
public void thawApp(final String appId) throws YarnException, IOException, InterruptedException {
    ApplicationId applicationId = invokeSliderClientRunnable(new SliderClientContextRunnable<ApplicationId>() {
        @Override//w w w  . j a  v a  2s  .  c om
        public ApplicationId run(SliderClient sliderClient)
                throws YarnException, IOException, InterruptedException {
            Set<String> properties = new HashSet<String>();
            properties.add("id");
            properties.add("name");
            final SliderApp sliderApp = getSliderApp(appId, properties);
            if (sliderApp == null)
                throw new ApplicationNotFoundException(appId);
            ActionThawArgs thawArgs = new ActionThawArgs();
            sliderClient.actionThaw(sliderApp.getName(), thawArgs);
            return sliderClient.applicationId;
        }
    });
    logger.info("Thawed Slider App [" + appId + "] with response: " + applicationId.toString());
}

From source file:org.apache.ambari.view.slider.SliderAppsViewControllerImpl.java

License:Apache License

@Override
public void flexApp(final String appId, final Map<String, Integer> componentsMap)
        throws YarnException, IOException, InterruptedException {
    ApplicationId applicationId = invokeSliderClientRunnable(new SliderClientContextRunnable<ApplicationId>() {
        @Override//from   ww w . j  a v  a 2s .  c om
        public ApplicationId run(SliderClient sliderClient)
                throws YarnException, IOException, InterruptedException {
            Set<String> properties = new HashSet<String>();
            properties.add("id");
            properties.add("name");
            final SliderApp sliderApp = getSliderApp(appId, properties);
            if (sliderApp == null) {
                throw new ApplicationNotFoundException(appId);
            }
            ActionFlexArgs flexArgs = new ActionFlexArgs();
            flexArgs.parameters.add(sliderApp.getName());
            for (Entry<String, Integer> e : componentsMap.entrySet()) {
                flexArgs.componentDelegate.componentTuples.add(e.getKey());
                flexArgs.componentDelegate.componentTuples.add(e.getValue().toString());
            }
            sliderClient.actionFlex(sliderApp.getName(), flexArgs);
            return sliderClient.applicationId;
        }
    });
    logger.info("Flexed Slider App [" + appId + "] with response: " + applicationId);
}