Example #1
0
 @Override
 public List<ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId)
     throws YarnException, IOException {
   try {
     GetApplicationAttemptsRequest request =
         Records.newRecord(GetApplicationAttemptsRequest.class);
     request.setApplicationId(appId);
     GetApplicationAttemptsResponse response = rmClient.getApplicationAttempts(request);
     return response.getApplicationAttemptList();
   } 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.getApplicationAttempts(appId);
   }
 }