@Override public void close() { if (!sharedYarnClient) { yarnClient.stop(); } }
@VisibleForTesting void stopYarnClient() { this.yarnClient.stop(); }
/** * Kills YARN application and stops YARN client. * * <p>Use this method to kill the App before it has been properly deployed */ private void failSessionDuringDeployment(YarnClient yarnClient, YarnClientApplication yarnApplication) { LOG.info("Killing YARN application"); try { yarnClient.killApplication(yarnApplication.getNewApplicationResponse().getApplicationId()); } catch (Exception e) { // we only log a debug message here because the "killApplication" call is a best-effort // call (we don't know if the application has been deployed when the error occured). LOG.debug("Error while killing YARN application", e); } yarnClient.stop(); }
@AfterClass public static void tearDownClass() { yarnClient.stop(); }
public boolean isApplicationAccepted(HiveConf conf, String applicationId) { if (applicationId == null) { return false; } YarnClient yarnClient = null; try { LOG.info("Trying to find " + applicationId); ApplicationId appId = getApplicationIDFromString(applicationId); yarnClient = YarnClient.createYarnClient(); yarnClient.init(conf); yarnClient.start(); ApplicationReport appReport = yarnClient.getApplicationReport(appId); return appReport != null && appReport.getYarnApplicationState() == YarnApplicationState.ACCEPTED; } catch (Exception ex) { LOG.error("Failed getting application status for: " + applicationId + ": " + ex, ex); return false; } finally { if (yarnClient != null) { try { yarnClient.stop(); } catch (Exception ex) { LOG.error("Failed to stop yarn client: " + ex, ex); } } } } }
public static boolean isApplicationAccepted(HiveConf conf, String applicationId) { if (applicationId == null) { return false; } YarnClient yarnClient = null; try { ApplicationId appId = getApplicationIDFromString(applicationId); yarnClient = YarnClient.createYarnClient(); yarnClient.init(conf); yarnClient.start(); ApplicationReport appReport = yarnClient.getApplicationReport(appId); return appReport != null && appReport.getYarnApplicationState() == YarnApplicationState.ACCEPTED; } catch (Exception ex) { LOG.error("Failed getting application status for: " + applicationId + ": " + ex, ex); return false; } finally { if (yarnClient != null) { try { yarnClient.stop(); } catch (Exception ex) { LOG.error("Failed to stop yarn client: " + ex, ex); } } } }
public void stop() { this.client.stop(); } }
@Override public void close() { if (!sharedYarnClient) { yarnClient.stop(); } }
public void stop() { this.client.stop(); } }
@Override public void close() { if (!sharedYarnClient) { yarnClient.stop(); } }
@Override public void stop() { isRunning = false; yarnClient.stop(); }
/** * This function stops the YarnUtil by stopping the yarn client and http client. */ public void stop() { try { httpclient.close(); } catch (IOException e) { log.error("HTTP Client failed to close.", e); } yarnClient.stop(); }
@Override protected void shutDown() throws Exception { yarnClient.stop(); super.shutDown(); }
@Override protected void serviceStop() throws Exception { client.stop(); super.serviceStop(); }
public void stop() { if (_client != null) { _client.close(); } _yarn.stop(); }
@Override protected void serviceStop() throws Exception { client.stop(); super.serviceStop(); }
@Override public YarnApplicationReport getReport() { YarnClient yarnClient = createYarnClient(); try { return new Hadoop21YarnApplicationReport(yarnClient.getApplicationReport(appId)); } catch (YarnException | IOException e) { throw new RuntimeException("Failed to get application report for " + appId, e); } finally { yarnClient.stop(); } }
@Override public YarnApplicationReport getReport() { YarnClient yarnClient = createYarnClient(); try { return new Hadoop21YarnApplicationReport(yarnClient.getApplicationReport(appId)); } catch (YarnException | IOException e) { throw new RuntimeException("Failed to get application report for " + appId, e); } finally { yarnClient.stop(); } }
@Override public List<NodeReport> getNodeReports() throws Exception { YarnClient yarnClient = createYarnClient(); try { return yarnClient.getNodeReports(); } finally { yarnClient.stop(); } }
YarnClient client = YarnClient.createYarnClient(); Configuration config = context.getConfiguration(); client.init(new YarnConfiguration(config)); client.start(); try { List<NodeReport> reports = client.getNodeReports(NodeState.RUNNING); System.out.println(reports.size()); } catch (Exception ex) { System.err.println(ex.getMessage()); } client.stop();