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

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

Introduction

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

Prototype

public YarnException(String message, Throwable cause) 

Source Link

Usage

From source file:com.twitter.hraven.hadoopJobMonitor.rpc.ClientCache.java

License:Apache License

public synchronized ClientServiceDelegate getClient(JobID jobId) throws YarnException {
    if (hsProxy == null) {
        try {//from  w w  w .  jav  a 2  s.c om
            hsProxy = instantiateHistoryProxy();
        } catch (IOException e) {
            LOG.warn("Could not connect to History server.", e);
            throw new YarnException("Could not connect to History server.", e);
        }
    }
    ClientServiceDelegate client = cache.get(jobId);
    if (client == null) {
        client = new ClientServiceDelegate(conf, rm, jobId, hsProxy);
        cache.put(jobId, client);
    }
    return client;
}

From source file:org.trustedanalytics.servicebroker.gearpump.yarn.YarnAppManager.java

License:Apache License

/**
 * Remove application from YARN.//from  w  ww  .  ja v a2s  . c  o  m
 * @param applicationId should be in format application_1449093574559_0004
 * @throws YarnException
 */
public void killApplication(String applicationId) throws YarnException {
    if (applicationId != null) {
        try (YarnClient yarnClient = getYarnClient()) {
            yarnClient.killApplication(getApplicationId(applicationId));
        } catch (ApplicationNotFoundException anfe) {
            LOGGER.warn(String.format("Haven't found application %s. Assuming it was removed manually.",
                    applicationId), anfe);
        } catch (IOException | LoginException e) {
            throw new YarnException("YARN error during application removal.", e);
        }
    }
}

From source file:org.trustedanalytics.servicebroker.h2oprovisioner.cdhclients.DeprovisionerYarnClient.java

License:Apache License

public ApplicationId getH2oJobId(String serviceInstanceId) throws YarnException, JobNotFoundException {
    String h2oJobName = DeprovisionerYarnClient.h2oJobName(serviceInstanceId);

    List<ApplicationReport> foundJobs;
    try {/*from  w  w w  .j  a va 2s  . c o m*/
        foundJobs = getJobListByName(h2oJobName);
    } catch (YarnException | IOException e) {
        throw new YarnException("Error obtaining H2O job id from YARN: ", e);
    }

    if (foundJobs.isEmpty()) {
        throw new JobNotFoundException("No such H2O job on YARN exists");
    }

    if (foundJobs.size() > 1) {
        throw new YarnException("Error obtaining H2O job id from YARN. Found " + foundJobs.size()
                + " apps with name " + h2oJobName);
    } else {
        return foundJobs.get(0).getApplicationId();
    }
}