use of org.apache.hadoop.yarn.api.records.ApplicationAttemptReport in project hadoop by apache.
the class WebServices method getAppAttempt.
public AppAttemptInfo getAppAttempt(HttpServletRequest req, HttpServletResponse res, String appId, String appAttemptId) {
UserGroupInformation callerUGI = getUser(req);
ApplicationId aid = parseApplicationId(appId);
final ApplicationAttemptId aaid = parseApplicationAttemptId(appAttemptId);
validateIds(aid, aaid, null);
ApplicationAttemptReport appAttempt = null;
try {
if (callerUGI == null) {
GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.newInstance(aaid);
appAttempt = appBaseProt.getApplicationAttemptReport(request).getApplicationAttemptReport();
} else {
appAttempt = callerUGI.doAs(new PrivilegedExceptionAction<ApplicationAttemptReport>() {
@Override
public ApplicationAttemptReport run() throws Exception {
GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.newInstance(aaid);
return appBaseProt.getApplicationAttemptReport(request).getApplicationAttemptReport();
}
});
}
} catch (Exception e) {
rewrapAndThrowException(e);
}
if (appAttempt == null) {
throw new NotFoundException("app attempt with id: " + appAttemptId + " not found");
}
return new AppAttemptInfo(appAttempt);
}
use of org.apache.hadoop.yarn.api.records.ApplicationAttemptReport in project hadoop by apache.
the class WebServices method getAppAttempts.
public AppAttemptsInfo getAppAttempts(HttpServletRequest req, HttpServletResponse res, String appId) {
UserGroupInformation callerUGI = getUser(req);
final ApplicationId id = parseApplicationId(appId);
Collection<ApplicationAttemptReport> appAttemptReports = null;
try {
if (callerUGI == null) {
GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.newInstance(id);
appAttemptReports = appBaseProt.getApplicationAttempts(request).getApplicationAttemptList();
} else {
appAttemptReports = callerUGI.doAs(new PrivilegedExceptionAction<Collection<ApplicationAttemptReport>>() {
@Override
public Collection<ApplicationAttemptReport> run() throws Exception {
GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.newInstance(id);
return appBaseProt.getApplicationAttempts(request).getApplicationAttemptList();
}
});
}
} catch (Exception e) {
rewrapAndThrowException(e);
}
AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo();
if (appAttemptReports == null) {
return appAttemptsInfo;
}
for (ApplicationAttemptReport appAttemptReport : appAttemptReports) {
AppAttemptInfo appAttemptInfo = new AppAttemptInfo(appAttemptReport);
appAttemptsInfo.add(appAttemptInfo);
}
return appAttemptsInfo;
}
use of org.apache.hadoop.yarn.api.records.ApplicationAttemptReport in project hadoop by apache.
the class MockResourceManagerFacade method getApplicationAttemptReport.
@Override
public GetApplicationAttemptReportResponse getApplicationAttemptReport(GetApplicationAttemptReportRequest request) throws YarnException, IOException {
GetApplicationAttemptReportResponse response = Records.newRecord(GetApplicationAttemptReportResponse.class);
ApplicationAttemptReport report = Records.newRecord(ApplicationAttemptReport.class);
report.setApplicationAttemptId(request.getApplicationAttemptId());
report.setYarnApplicationAttemptState(YarnApplicationAttemptState.LAUNCHED);
response.setApplicationAttemptReport(report);
return response;
}
use of org.apache.hadoop.yarn.api.records.ApplicationAttemptReport in project hadoop by apache.
the class RMAppAttemptImpl method createApplicationAttemptReport.
@Override
public ApplicationAttemptReport createApplicationAttemptReport() {
this.readLock.lock();
ApplicationAttemptReport attemptReport = null;
try {
// AM container maybe not yet allocated. and also unmangedAM doesn't have
// am container.
ContainerId amId = masterContainer == null ? null : masterContainer.getId();
attemptReport = ApplicationAttemptReport.newInstance(this.getAppAttemptId(), this.getHost(), this.getRpcPort(), this.getTrackingUrl(), this.getOriginalTrackingUrl(), this.getDiagnostics(), createApplicationAttemptState(), amId, this.startTime, this.finishTime);
} finally {
this.readLock.unlock();
}
return attemptReport;
}
use of org.apache.hadoop.yarn.api.records.ApplicationAttemptReport in project hadoop by apache.
the class LogsCLI method getContainerReportsFromRunningApplication.
private List<ContainerReport> getContainerReportsFromRunningApplication(ContainerLogsRequest options) throws YarnException, IOException {
List<ContainerReport> reports = new ArrayList<ContainerReport>();
List<ApplicationAttemptReport> attempts = yarnClient.getApplicationAttempts(options.getAppId());
Map<ContainerId, ContainerReport> containerMap = new TreeMap<ContainerId, ContainerReport>();
for (ApplicationAttemptReport attempt : attempts) {
List<ContainerReport> containers = yarnClient.getContainers(attempt.getApplicationAttemptId());
for (ContainerReport container : containers) {
if (!containerMap.containsKey(container.getContainerId())) {
containerMap.put(container.getContainerId(), container);
}
}
}
reports.addAll(containerMap.values());
return reports;
}
Aggregations