private static ApplicationReport getApplicationReport(ApplicationId appId, YarnClient yarnClient) throws YarnException, IOException { return yarnClient.getApplicationReport(appId); }
private void tryRetrieveAndLogApplicationReport(YarnClient yarnClient, ApplicationId yarnApplicationId) { ApplicationReport applicationReport; try { applicationReport = yarnClient.getApplicationReport(yarnApplicationId); } catch (YarnException | IOException e) { LOG.info("Could not log the final application report.", e); applicationReport = null; } if (applicationReport != null) { logApplicationReport(applicationReport); } }
public ApplicationReport getAppReport() throws YarnClientException { try { return yarnClient.getApplicationReport(appId); } catch (YarnException | IOException e) { throw new YarnClientException("Get application report failed", e); } }
@Override public void run() { try { eventBus.post(new ApplicationReportArrivalEvent(yarnClient.getApplicationReport(applicationId.get()))); } catch (YarnException | IOException e) { LOGGER.error("Failed to get application report for Gobblin Yarn application " + applicationId.get(), e); eventBus.post(new GetApplicationReportFailureEvent(e)); } } }, 0, this.appReportIntervalMinutes, TimeUnit.MINUTES);
private void updateApplicationStatus() { if (yarnClient.isInState(Service.STATE.STARTED)) { final ApplicationReport applicationReport; try { applicationReport = yarnClient.getApplicationReport(yarnApplicationId); } catch (Exception e) { LOG.info("Could not retrieve the Yarn application report for {}.", yarnApplicationId); applicationStatus = ApplicationStatus.UNKNOWN; return; } YarnApplicationState yarnApplicationState = applicationReport.getYarnApplicationState(); if (yarnApplicationState == YarnApplicationState.FAILED || yarnApplicationState == YarnApplicationState.KILLED) { applicationStatus = ApplicationStatus.FAILED; } else { applicationStatus = ApplicationStatus.SUCCEEDED; } } else { LOG.info("Yarn client is no longer in state STARTED. Stopping the Yarn application status monitor."); applicationStatusUpdateFuture.cancel(false); } } }
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); } } } } }
final ApplicationReport appReport = yarnClient.getApplicationReport(applicationId);
@Test(enabled=false, groups = { "disabledOnTravis" }, dependsOnMethods = "testSetupAndSubmitApplication") public void testGetReconnectableApplicationId() throws Exception { Assert.assertEquals(this.gobblinYarnAppLauncher.getReconnectableApplicationId().get(), this.applicationId); this.yarnClient.killApplication(this.applicationId); Assert.assertEquals(yarnClient.getApplicationReport(applicationId).getYarnApplicationState(), YarnApplicationState.KILLED, "Application not killed"); // takes some time for kill to take effect and app master to go down Thread.sleep(5000); }
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); } } } }
loop: while (true) { try { report = yarnClient.getApplicationReport(appId); } catch (IOException e) { throw new YarnDeploymentException("Failed to deploy the cluster.", e);
appReport = serviceClient.getYarnClient().getApplicationReport(appId); if (timeoutMs == 0) {
/** * For some yet unknown reason, hostname resolution for the ResourceManager in {@link MiniYARNCluster} * has some issue that causes the {@link YarnClient} not be able to connect and submit the Gobblin Yarn * application successfully. This works fine on local machine though. So disabling this and the test * below that depends on it on Travis-CI. */ @Test(enabled=false, groups = { "disabledOnTravis" }, dependsOnMethods = "testCreateHelixCluster") public void testSetupAndSubmitApplication() throws Exception { this.gobblinYarnAppLauncher.startYarnClient(); this.applicationId = this.gobblinYarnAppLauncher.setupAndSubmitApplication(); int i; // wait for application to come up for (i = 0; i < 120; i++) { if (yarnClient.getApplicationReport(applicationId).getYarnApplicationState() == YarnApplicationState.RUNNING) { break; } Thread.sleep(1000); } Assert.assertTrue(i < 120, "timed out waiting for RUNNING state"); // wait another 10 seconds and check state again to make sure that the application stays up Thread.sleep(10000); Assert.assertEquals(yarnClient.getApplicationReport(applicationId).getYarnApplicationState(), YarnApplicationState.RUNNING, "Application may have aborted"); }
ApplicationReport report = jstormClientContext.yarnClient.getApplicationReport(appId);
@Override public void start(CallbackHandler resourceCallback, org.apache.hadoop.yarn.client.api.async.NMClientAsync.CallbackHandler nodeCallback ) { conf = new YarnConfiguration(); resourceMgr = AMRMClientAsync.createAMRMClientAsync(pollPeriodMs, resourceCallback); resourceMgr.init(conf); resourceMgr.start(); // Create the asynchronous node manager client nodeMgr = NMClientAsync.createNMClientAsync(nodeCallback); nodeMgr.init(conf); nodeMgr.start(); client = YarnClient.createYarnClient(); client.init(conf); client.start(); String appIdStr = System.getenv(DrillOnYarnConfig.APP_ID_ENV_VAR); if (appIdStr != null) { appId = ConverterUtils.toApplicationId(appIdStr); try { appReport = client.getApplicationReport(appId); } catch (YarnException | IOException e) { LOG.error( "Failed to get YARN applicaiton report for App ID: " + appIdStr, e); } } }
ApplicationReport appReport = yarnClient.getApplicationReport(appId); YarnApplicationState appState = appReport.getYarnApplicationState(); TimeUnit.SECONDS.sleep(1L); appReport = yarnClient.getApplicationReport(appId);
private void waitForApplicationAttempt(final ApplicationId applicationId, final int attemptId) throws Exception { final YarnClient yarnClient = getYarnClient(); checkState(yarnClient != null, "yarnClient must be initialized"); waitUntilCondition(() -> { final ApplicationReport applicationReport = yarnClient.getApplicationReport(applicationId); return applicationReport.getCurrentApplicationAttemptId().getAttemptId() >= attemptId; }, Deadline.fromNow(TIMEOUT)); }
ApplicationReport applicationReport = this.yarnClient.getApplicationReport(applicationId); LOGGER.info("Application Name: " + applicationReport.getName()); LOGGER.info("Application Tracking URL: " + applicationReport.getTrackingUrl());
final ApplicationReport applicationReport = yarnClient.getApplicationReport(clusterId);
private ApplicationReport poll() throws IOException, YarnException { ApplicationReport report; report = yarnClient.getApplicationReport(appId); YarnApplicationState appState = report.getYarnApplicationState(); LOG.debug("Application State: {}", appState);
public static YarnApplicationState pollFinishedApplicationState(YarnClient client, ApplicationId appId) throws IOException, YarnException, InterruptedException { EnumSet<YarnApplicationState> finishedState = EnumSet.of(FINISHED, KILLED, FAILED); while (true) { ApplicationReport report = client.getApplicationReport(appId); YarnApplicationState state = report.getYarnApplicationState(); if (finishedState.contains(state)) { return state; } else { Thread.sleep(250); } } }