@Override
    public GetApplicationReportResponse getApplicationReport(GetApplicationReportRequest request)
        throws IOException {
      ApplicationId applicationId = request.getApplicationId();
      ApplicationReport application = recordFactory.newRecordInstance(ApplicationReport.class);
      application.setApplicationId(applicationId);
      application.setFinalApplicationStatus(FinalApplicationStatus.UNDEFINED);
      if (amRunning) {
        application.setYarnApplicationState(YarnApplicationState.RUNNING);
      } else if (amRestarting) {
        application.setYarnApplicationState(YarnApplicationState.SUBMITTED);
      } else {
        application.setYarnApplicationState(YarnApplicationState.FINISHED);
        application.setFinalApplicationStatus(FinalApplicationStatus.SUCCEEDED);
      }
      String[] split = AMHOSTADDRESS.split(":");
      application.setHost(split[0]);
      application.setRpcPort(Integer.parseInt(split[1]));
      application.setUser("TestClientRedirect-user");
      application.setName("N/A");
      application.setQueue("N/A");
      application.setStartTime(0);
      application.setFinishTime(0);
      application.setTrackingUrl("N/A");
      application.setDiagnostics("N/A");

      GetApplicationReportResponse response =
          recordFactory.newRecordInstance(GetApplicationReportResponse.class);
      response.setApplicationReport(application);
      return response;
    }
示例#2
0
 @Private
 @Unstable
 public static ApplicationReport newInstance(
     ApplicationId applicationId,
     ApplicationAttemptId applicationAttemptId,
     String user,
     String queue,
     String name,
     String host,
     int rpcPort,
     Token clientToAMToken,
     YarnApplicationState state,
     String diagnostics,
     String url,
     long startTime,
     long finishTime,
     FinalApplicationStatus finalStatus,
     ApplicationResourceUsageReport appResources,
     String origTrackingUrl,
     float progress,
     String applicationType,
     Token amRmToken) {
   ApplicationReport report = Records.newRecord(ApplicationReport.class);
   report.setApplicationId(applicationId);
   report.setCurrentApplicationAttemptId(applicationAttemptId);
   report.setUser(user);
   report.setQueue(queue);
   report.setName(name);
   report.setHost(host);
   report.setRpcPort(rpcPort);
   report.setClientToAMToken(clientToAMToken);
   report.setYarnApplicationState(state);
   report.setDiagnostics(diagnostics);
   report.setTrackingUrl(url);
   report.setStartTime(startTime);
   report.setFinishTime(finishTime);
   report.setFinalApplicationStatus(finalStatus);
   report.setApplicationResourceUsageReport(appResources);
   report.setOriginalTrackingUrl(origTrackingUrl);
   report.setProgress(progress);
   report.setApplicationType(applicationType);
   report.setAMRMToken(amRmToken);
   return report;
 }