YARN-1904. Ensure exceptions thrown in ClientRMService & ApplicationHistoryClientService are uniform when application-attempt is not found. Contributed by Zhijie Shen.
This commit is contained in:
parent
e2803f5a51
commit
29c77de297
|
@ -214,6 +214,10 @@ Release 2.7.0 - UNRELEASED
|
||||||
YARN-1582. Capacity Scheduler: add a maximum-allocation-mb setting per
|
YARN-1582. Capacity Scheduler: add a maximum-allocation-mb setting per
|
||||||
queue (Thomas Graves via jlowe)
|
queue (Thomas Graves via jlowe)
|
||||||
|
|
||||||
|
YARN-1904. Ensure exceptions thrown in ClientRMService &
|
||||||
|
ApplicationHistoryClientService are uniform when application-attempt is
|
||||||
|
not found. (zjshen via acmurthy)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -49,9 +49,11 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenRequest;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse;
|
import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest;
|
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse;
|
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
|
import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
|
||||||
|
@ -153,13 +155,17 @@ public class ApplicationHistoryClientService extends AbstractService {
|
||||||
public GetApplicationAttemptReportResponse getApplicationAttemptReport(
|
public GetApplicationAttemptReportResponse getApplicationAttemptReport(
|
||||||
GetApplicationAttemptReportRequest request) throws YarnException,
|
GetApplicationAttemptReportRequest request) throws YarnException,
|
||||||
IOException {
|
IOException {
|
||||||
|
ApplicationAttemptId appAttemptId = request.getApplicationAttemptId();
|
||||||
try {
|
try {
|
||||||
GetApplicationAttemptReportResponse response =
|
GetApplicationAttemptReportResponse response =
|
||||||
GetApplicationAttemptReportResponse.newInstance(history
|
GetApplicationAttemptReportResponse.newInstance(history
|
||||||
.getApplicationAttempt(request.getApplicationAttemptId()));
|
.getApplicationAttempt(appAttemptId));
|
||||||
return response;
|
return response;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ApplicationAttemptNotFoundException(e.getMessage());
|
String msg = "ApplicationAttempt with id '" + appAttemptId +
|
||||||
|
"' doesn't exist in the history store.";
|
||||||
|
LOG.error(msg, e);
|
||||||
|
throw new ApplicationAttemptNotFoundException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,14 +183,17 @@ public class ApplicationHistoryClientService extends AbstractService {
|
||||||
@Override
|
@Override
|
||||||
public GetApplicationReportResponse getApplicationReport(
|
public GetApplicationReportResponse getApplicationReport(
|
||||||
GetApplicationReportRequest request) throws YarnException, IOException {
|
GetApplicationReportRequest request) throws YarnException, IOException {
|
||||||
try {
|
|
||||||
ApplicationId applicationId = request.getApplicationId();
|
ApplicationId applicationId = request.getApplicationId();
|
||||||
|
try {
|
||||||
GetApplicationReportResponse response =
|
GetApplicationReportResponse response =
|
||||||
GetApplicationReportResponse.newInstance(history
|
GetApplicationReportResponse.newInstance(history
|
||||||
.getApplication(applicationId));
|
.getApplication(applicationId));
|
||||||
return response;
|
return response;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ApplicationNotFoundException(e.getMessage());
|
String msg = "Application with id '" + applicationId +
|
||||||
|
"' doesn't exist in the history store.";
|
||||||
|
LOG.error(msg, e);
|
||||||
|
throw new ApplicationNotFoundException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,13 +209,17 @@ public class ApplicationHistoryClientService extends AbstractService {
|
||||||
@Override
|
@Override
|
||||||
public GetContainerReportResponse getContainerReport(
|
public GetContainerReportResponse getContainerReport(
|
||||||
GetContainerReportRequest request) throws YarnException, IOException {
|
GetContainerReportRequest request) throws YarnException, IOException {
|
||||||
|
ContainerId containerId = request.getContainerId();
|
||||||
try {
|
try {
|
||||||
GetContainerReportResponse response =
|
GetContainerReportResponse response =
|
||||||
GetContainerReportResponse.newInstance(history.getContainer(request
|
GetContainerReportResponse.newInstance(
|
||||||
.getContainerId()));
|
history.getContainer(containerId));
|
||||||
return response;
|
return response;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ContainerNotFoundException(e.getMessage());
|
String msg = "Container with id '" + containerId +
|
||||||
|
"' doesn't exist in the history store.";
|
||||||
|
LOG.error(msg, e);
|
||||||
|
throw new ContainerNotFoundException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,8 +365,9 @@ public class ClientRMService extends AbstractService implements
|
||||||
if (allowAccess) {
|
if (allowAccess) {
|
||||||
RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
|
RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
|
||||||
if (appAttempt == null) {
|
if (appAttempt == null) {
|
||||||
throw new ApplicationAttemptNotFoundException("ApplicationAttempt "
|
throw new ApplicationAttemptNotFoundException(
|
||||||
+ appAttemptId + " Not Found in RM");
|
"ApplicationAttempt with id '" + appAttemptId +
|
||||||
|
"' doesn't exist in RM.");
|
||||||
}
|
}
|
||||||
ApplicationAttemptReport attemptReport = appAttempt
|
ApplicationAttemptReport attemptReport = appAttempt
|
||||||
.createApplicationAttemptReport();
|
.createApplicationAttemptReport();
|
||||||
|
@ -450,14 +451,15 @@ public class ClientRMService extends AbstractService implements
|
||||||
if (allowAccess) {
|
if (allowAccess) {
|
||||||
RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
|
RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
|
||||||
if (appAttempt == null) {
|
if (appAttempt == null) {
|
||||||
throw new ApplicationAttemptNotFoundException("ApplicationAttempt "
|
throw new ApplicationAttemptNotFoundException(
|
||||||
+ appAttemptId + " Not Found in RM");
|
"ApplicationAttempt with id '" + appAttemptId +
|
||||||
|
"' doesn't exist in RM.");
|
||||||
}
|
}
|
||||||
RMContainer rmConatiner = this.rmContext.getScheduler().getRMContainer(
|
RMContainer rmConatiner = this.rmContext.getScheduler().getRMContainer(
|
||||||
containerId);
|
containerId);
|
||||||
if (rmConatiner == null) {
|
if (rmConatiner == null) {
|
||||||
throw new ContainerNotFoundException("Container with id " + containerId
|
throw new ContainerNotFoundException("Container with id '" + containerId
|
||||||
+ " not found");
|
+ "' doesn't exist in RM.");
|
||||||
}
|
}
|
||||||
response = GetContainerReportResponse.newInstance(rmConatiner
|
response = GetContainerReportResponse.newInstance(rmConatiner
|
||||||
.createContainerReport());
|
.createContainerReport());
|
||||||
|
@ -499,8 +501,9 @@ public class ClientRMService extends AbstractService implements
|
||||||
if (allowAccess) {
|
if (allowAccess) {
|
||||||
RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
|
RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId);
|
||||||
if (appAttempt == null) {
|
if (appAttempt == null) {
|
||||||
throw new ApplicationAttemptNotFoundException("ApplicationAttempt "
|
throw new ApplicationAttemptNotFoundException(
|
||||||
+ appAttemptId + " Not Found in RM");
|
"ApplicationAttempt with id '" + appAttemptId +
|
||||||
|
"' doesn't exist in RM.");
|
||||||
}
|
}
|
||||||
Collection<RMContainer> rmContainers = Collections.emptyList();
|
Collection<RMContainer> rmContainers = Collections.emptyList();
|
||||||
SchedulerAppReport schedulerAppReport =
|
SchedulerAppReport schedulerAppReport =
|
||||||
|
|
Loading…
Reference in New Issue