gpt4 book ai didi

org.apache.hadoop.yarn.client.api.YarnClient.getApplicationReport()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 20:20:40 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.yarn.client.api.YarnClient.getApplicationReport()方法的一些代码示例,展示了YarnClient.getApplicationReport()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnClient.getApplicationReport()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.client.api.YarnClient
类名称:YarnClient
方法名:getApplicationReport

YarnClient.getApplicationReport介绍

[英]Get a report of the given Application.

In secure mode, YARN verifies access to the application, queue etc. before accepting the request.

If the user does not have VIEW_APP access then the following fields in the report will be set to stubbed values:

  • host - set to "N/A"
  • RPC port - set to -1
  • client token - set to "N/A"
  • diagnostics - set to "N/A"
  • tracking URL - set to "N/A"
  • original tracking URL - set to "N/A"
  • resource usage report - all values are -1
    [中]

代码示例

代码示例来源:origin: Qihoo360/XLearning

private static ApplicationReport getApplicationReport(ApplicationId appId, YarnClient yarnClient)
  throws YarnException, IOException {
 return yarnClient.getApplicationReport(appId);
}

代码示例来源:origin: apache/flink

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);
  }
}

代码示例来源:origin: apache/drill

public ApplicationReport getAppReport() throws YarnClientException {
 try {
  return yarnClient.getApplicationReport(appId);
 } catch (YarnException | IOException e) {
  throw new YarnClientException("Get application report failed", e);
 }
}

代码示例来源:origin: apache/incubator-gobblin

@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);

代码示例来源:origin: apache/flink

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);
    }
  }
}

代码示例来源:origin: apache/hive

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);
    }
   }
  }
 }
}

代码示例来源:origin: apache/flink

final ApplicationReport appReport = yarnClient.getApplicationReport(applicationId);

代码示例来源:origin: apache/incubator-gobblin

@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);
}

代码示例来源:origin: apache/hive

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);
   }
  }
 }
}

代码示例来源:origin: apache/flink

loop: while (true) {
  try {
    report = yarnClient.getApplicationReport(appId);
  } catch (IOException e) {
    throw new YarnDeploymentException("Failed to deploy the cluster.", e);

代码示例来源:origin: apache/hive

appReport = serviceClient.getYarnClient().getApplicationReport(appId);
if (timeoutMs == 0) {

代码示例来源:origin: apache/incubator-gobblin

/**
 * 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");
}

代码示例来源:origin: alibaba/jstorm

ApplicationReport report = jstormClientContext.yarnClient.getApplicationReport(appId);

代码示例来源:origin: apache/drill

@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);
  }
 }
}

代码示例来源:origin: apache/ignite

ApplicationReport appReport = yarnClient.getApplicationReport(appId);
YarnApplicationState appState = appReport.getYarnApplicationState();
  TimeUnit.SECONDS.sleep(1L);
  appReport = yarnClient.getApplicationReport(appId);

代码示例来源:origin: apache/flink

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));
}

代码示例来源:origin: apache/incubator-gobblin

ApplicationReport applicationReport = this.yarnClient.getApplicationReport(applicationId);
LOGGER.info("Application Name: " + applicationReport.getName());
LOGGER.info("Application Tracking URL: " + applicationReport.getTrackingUrl());

代码示例来源:origin: apache/flink

final ApplicationReport applicationReport = yarnClient.getApplicationReport(clusterId);

代码示例来源:origin: uber/AthenaX

private ApplicationReport poll() throws IOException, YarnException {
 ApplicationReport report;
 report = yarnClient.getApplicationReport(appId);
 YarnApplicationState appState = report.getYarnApplicationState();
 LOG.debug("Application State: {}", appState);

代码示例来源:origin: uber/AthenaX

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);
  }
 }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com