Example #1
0
 @Override
 public ApplicationAttemptReport getApplicationAttemptReport(ApplicationAttemptId appAttemptId)
     throws YarnException, IOException {
   try {
     GetApplicationAttemptReportRequest request =
         Records.newRecord(GetApplicationAttemptReportRequest.class);
     request.setApplicationAttemptId(appAttemptId);
     GetApplicationAttemptReportResponse response = rmClient.getApplicationAttemptReport(request);
     return response.getApplicationAttemptReport();
   } catch (YarnException e) {
     if (!historyServiceEnabled) {
       // Just throw it as usual if historyService is not enabled.
       throw e;
     }
     // Even if history-service is enabled, treat all exceptions still the same
     // except the following
     if (e.getClass() != ApplicationNotFoundException.class) {
       throw e;
     }
     return historyClient.getApplicationAttemptReport(appAttemptId);
   }
 }
 @Override
 public ApplicationAttemptReport getApplicationAttemptReport(ApplicationAttemptId appAttemptId)
     throws YarnException, IOException {
   when(mockAttemptResponse.getApplicationAttemptReport()).thenReturn(getAttempt(appAttemptId));
   return super.getApplicationAttemptReport(appAttemptId);
 }