コード例 #1
0
 public ApplicationReport getApplicationReport(ApplicationId appId) throws YarnRemoteException {
   GetApplicationReportRequest request =
       recordFactory.newRecordInstance(GetApplicationReportRequest.class);
   request.setApplicationId(appId);
   GetApplicationReportResponse response = applicationsManager.getApplicationReport(request);
   ApplicationReport applicationReport = response.getApplicationReport();
   return applicationReport;
 }
コード例 #2
0
  public ApplicationReport getApplicationReport(ApplicationId appId) throws YarnRemoteException {

    if (clientResourceManager == null)
      throw new IllegalStateException("Cannot query for a report without first connecting!");

    GetApplicationReportRequest req = Records.newRecord(GetApplicationReportRequest.class);
    req.setApplicationId(appId);

    return clientResourceManager.getApplicationReport(req).getApplicationReport();
  }
コード例 #3
0
    @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;
    }
コード例 #4
0
ファイル: YarnClientImpl.java プロジェクト: JoeChien23/hadoop
 @Override
 public ApplicationReport getApplicationReport(ApplicationId appId)
     throws YarnException, IOException {
   GetApplicationReportResponse response = null;
   try {
     GetApplicationReportRequest request = Records.newRecord(GetApplicationReportRequest.class);
     request.setApplicationId(appId);
     response = rmClient.getApplicationReport(request);
   } 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.getApplicationReport(appId);
   }
   return response.getApplicationReport();
 }
  private void verifyGetClientAMToken(
      String submitter, String queueAdmin, String queueName, boolean setupACLs) throws Exception {
    ApplicationId applicationId = submitAppAndGetAppId(submitter, queueName, setupACLs);
    final GetApplicationReportRequest appReportRequest =
        GetApplicationReportRequest.newInstance(applicationId);

    ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
    ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

    GetApplicationReportResponse submitterGetReport =
        submitterClient.getApplicationReport(appReportRequest);
    GetApplicationReportResponse adMinUserGetReport =
        adMinUserClient.getApplicationReport(appReportRequest);

    Assert.assertEquals(
        submitterGetReport.getApplicationReport().getClientToAMToken(),
        adMinUserGetReport.getApplicationReport().getClientToAMToken());
  }