本文整理汇总了Java中org.apache.hadoop.yarn.api.records.ApplicationReport.getDiagnostics方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationReport.getDiagnostics方法的具体用法?Java ApplicationReport.getDiagnostics怎么用?Java ApplicationReport.getDiagnostics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.yarn.api.records.ApplicationReport
的用法示例。
在下文中一共展示了ApplicationReport.getDiagnostics方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: submitJob
import org.apache.hadoop.yarn.api.records.ApplicationReport; //导入方法依赖的package包/类
@Override
public JobStatus submitJob(JobID jobId, String jobSubmitDir, Credentials ts)
throws IOException, InterruptedException {
addHistoryToken(ts);
// Construct necessary information to start the MR AM
ApplicationSubmissionContext appContext = createApplicationSubmissionContext(conf, jobSubmitDir, ts);
// Submit to ResourceManager
try {
ApplicationId applicationId = resMgrDelegate.submitApplication(appContext);
ApplicationReport appMaster = resMgrDelegate.getApplicationReport(applicationId);
String diagnostics = (appMaster == null ? "application report is null" : appMaster.getDiagnostics());
if (appMaster == null || appMaster.getYarnApplicationState() == YarnApplicationState.FAILED
|| appMaster.getYarnApplicationState() == YarnApplicationState.KILLED) {
throw new IOException("Failed to run job : " + diagnostics);
}
return clientCache.getClient(jobId).getJobStatus(jobId);
} catch (YarnException e) {
throw new IOException(e);
}
}
示例2: AppInfo
import org.apache.hadoop.yarn.api.records.ApplicationReport; //导入方法依赖的package包/类
public AppInfo(ApplicationReport app) {
appId = app.getApplicationId().toString();
if (app.getCurrentApplicationAttemptId() != null) {
currentAppAttemptId = app.getCurrentApplicationAttemptId().toString();
}
user = app.getUser();
queue = app.getQueue();
name = app.getName();
type = app.getApplicationType();
host = app.getHost();
rpcPort = app.getRpcPort();
appState = app.getYarnApplicationState();
diagnosticsInfo = app.getDiagnostics();
trackingUrl = app.getTrackingUrl();
originalTrackingUrl = app.getOriginalTrackingUrl();
submittedTime = app.getStartTime();
startedTime = app.getStartTime();
finishedTime = app.getFinishTime();
elapsedTime = Times.elapsed(startedTime, finishedTime);
finalAppStatus = app.getFinalApplicationStatus();
progress = app.getProgress() * 100; // in percent
if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) {
this.applicationTags = CSV_JOINER.join(app.getApplicationTags());
}
}
示例3: poll
import org.apache.hadoop.yarn.api.records.ApplicationReport; //导入方法依赖的package包/类
private ApplicationReport poll() throws IOException, YarnException {
ApplicationReport report;
report = yarnClient.getApplicationReport(appId);
YarnApplicationState appState = report.getYarnApplicationState();
LOG.debug("Application State: {}", appState);
switch (appState) {
case FAILED:
case FINISHED:
//TODO: the finished state may be valid in flip-6
case KILLED:
throw new IOException("The YARN application unexpectedly switched to state "
+ appState + " during deployment. \n"
+ "Diagnostics from YARN: " + report.getDiagnostics() + "\n"
+ "If log aggregation is enabled on your cluster, use this command to further investigate the issue:\n"
+ "yarn logs -applicationId " + appId);
//break ..
case RUNNING:
LOG.info("YARN application has been deployed successfully.");
break;
default:
if (appState != lastAppState) {
LOG.info("Deploying cluster, current state " + appState);
}
lastAppState = appState;
if (System.currentTimeMillis() - startTime > DEPLOY_TIMEOUT_MS) {
throw new RuntimeException(String.format("Deployment took more than %d seconds. "
+ "Please check if the requested resources are available in the YARN cluster", DEPLOY_TIMEOUT_MS));
}
return null;
}
return report;
}
示例4: retrieveDiagnostics
import org.apache.hadoop.yarn.api.records.ApplicationReport; //导入方法依赖的package包/类
public static String retrieveDiagnostics(YarnClient yarnClient, String applicationId) throws Exception {
ApplicationReport report = yarnClient.getApplicationReport(ConverterUtils.toApplicationId(applicationId));
String diagnostics = report.getDiagnostics();
if (isDiagnosticsEmpty(diagnostics)) {
throw new Exception("Retrieved Empty Diagnostics for " + applicationId);
}
return diagnostics;
}
示例5: submitJob
import org.apache.hadoop.yarn.api.records.ApplicationReport; //导入方法依赖的package包/类
@Override
public JobStatus submitJob(JobID jobId, String jobSubmitDir, Credentials ts)
throws IOException, InterruptedException {
addHistoryToken(ts);
// Construct necessary information to start the MR AM
ApplicationSubmissionContext appContext =
createApplicationSubmissionContext(conf, jobSubmitDir, ts);
// Submit to ResourceManager
try {
ApplicationId applicationId =
resMgrDelegate.submitApplication(appContext);
ApplicationReport appMaster = resMgrDelegate
.getApplicationReport(applicationId);
String diagnostics =
(appMaster == null ?
"application report is null" : appMaster.getDiagnostics());
if (appMaster == null
|| appMaster.getYarnApplicationState() == YarnApplicationState.FAILED
|| appMaster.getYarnApplicationState() == YarnApplicationState.KILLED) {
throw new IOException("Failed to run job : " +
diagnostics);
}
return clientCache.getClient(jobId).getJobStatus(jobId);
} catch (YarnException e) {
throw new IOException(e);
}
}
示例6: submitApplication
import org.apache.hadoop.yarn.api.records.ApplicationReport; //导入方法依赖的package包/类
@Override
public ApplicationId
submitApplication(ApplicationSubmissionContext appContext)
throws YarnException, IOException {
ApplicationId applicationId = appContext.getApplicationId();
if (applicationId == null) {
throw new ApplicationIdNotProvidedException(
"ApplicationId is not provided in ApplicationSubmissionContext");
}
SubmitApplicationRequest request =
Records.newRecord(SubmitApplicationRequest.class);
request.setApplicationSubmissionContext(appContext);
// Automatically add the timeline DT into the CLC
// Only when the security and the timeline service are both enabled
if (isSecurityEnabled() && timelineServiceEnabled) {
addTimelineDelegationToken(appContext.getAMContainerSpec());
}
//TODO: YARN-1763:Handle RM failovers during the submitApplication call.
rmClient.submitApplication(request);
int pollCount = 0;
long startTime = System.currentTimeMillis();
EnumSet<YarnApplicationState> waitingStates =
EnumSet.of(YarnApplicationState.NEW,
YarnApplicationState.NEW_SAVING,
YarnApplicationState.SUBMITTED);
EnumSet<YarnApplicationState> failToSubmitStates =
EnumSet.of(YarnApplicationState.FAILED,
YarnApplicationState.KILLED);
while (true) {
try {
ApplicationReport appReport = getApplicationReport(applicationId);
YarnApplicationState state = appReport.getYarnApplicationState();
if (!waitingStates.contains(state)) {
if(failToSubmitStates.contains(state)) {
throw new YarnException("Failed to submit " + applicationId +
" to YARN : " + appReport.getDiagnostics());
}
LOG.info("Submitted application " + applicationId);
break;
}
long elapsedMillis = System.currentTimeMillis() - startTime;
if (enforceAsyncAPITimeout() &&
elapsedMillis >= asyncApiPollTimeoutMillis) {
throw new YarnException("Timed out while waiting for application " +
applicationId + " to be submitted successfully");
}
// Notify the client through the log every 10 poll, in case the client
// is blocked here too long.
if (++pollCount % 10 == 0) {
LOG.info("Application submission is not finished, " +
"submitted application " + applicationId +
" is still in " + state);
}
try {
Thread.sleep(submitPollIntervalMillis);
} catch (InterruptedException ie) {
LOG.error("Interrupted while waiting for application "
+ applicationId
+ " to be successfully submitted.");
}
} catch (ApplicationNotFoundException ex) {
// FailOver or RM restart happens before RMStateStore saves
// ApplicationState
LOG.info("Re-submit application " + applicationId + "with the " +
"same ApplicationSubmissionContext");
rmClient.submitApplication(request);
}
}
return applicationId;
}