Java Code Examples for org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest#newInstance()

The following examples show how to use org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest#newInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueueACLsTestBase.java    From hadoop with Apache License 2.0 6 votes vote down vote up
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());
}
 
Example 2
Source File: TestRM.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test (timeout = 60000)
public void testInvalidatedAMHostPortOnAMRestart() throws Exception {
  MockRM rm1 = new MockRM(conf);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();

  // a failed app
  RMApp app2 = rm1.submitApp(200);
  MockAM am2 = MockRM.launchAndRegisterAM(app2, rm1, nm1);
  nm1
    .nodeHeartbeat(am2.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  am2.waitForState(RMAppAttemptState.FAILED);
  rm1.waitForState(app2.getApplicationId(), RMAppState.ACCEPTED);

  // before new attempt is launched, the app report returns the invalid AM
  // host and port.
  GetApplicationReportRequest request1 =
      GetApplicationReportRequest.newInstance(app2.getApplicationId());
  ApplicationReport report1 =
      rm1.getClientRMService().getApplicationReport(request1)
        .getApplicationReport();
  Assert.assertEquals("N/A", report1.getHost());
  Assert.assertEquals(-1, report1.getRpcPort());
}
 
Example 3
Source File: TestApplicationHistoryClientService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testApplicationReport() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  GetApplicationReportRequest request =
      GetApplicationReportRequest.newInstance(appId);
  GetApplicationReportResponse response =
      clientService.getApplicationReport(request);
  ApplicationReport appReport = response.getApplicationReport();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
      .getMemorySeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
      .getVcoreSeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
      .getGcoreSeconds());
  Assert.assertEquals("application_0_0001", appReport.getApplicationId()
    .toString());
  Assert.assertEquals("test app type",
      appReport.getApplicationType().toString());
  Assert.assertEquals("test queue", appReport.getQueue().toString());
}
 
Example 4
Source File: QueueACLsTestBase.java    From big-c with Apache License 2.0 6 votes vote down vote up
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());
}
 
Example 5
Source File: TestRM.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test (timeout = 60000)
public void testInvalidatedAMHostPortOnAMRestart() throws Exception {
  MockRM rm1 = new MockRM(conf);
  rm1.start();
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();

  // a failed app
  RMApp app2 = rm1.submitApp(200);
  MockAM am2 = MockRM.launchAndRegisterAM(app2, rm1, nm1);
  nm1
    .nodeHeartbeat(am2.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  am2.waitForState(RMAppAttemptState.FAILED);
  rm1.waitForState(app2.getApplicationId(), RMAppState.ACCEPTED);

  // before new attempt is launched, the app report returns the invalid AM
  // host and port.
  GetApplicationReportRequest request1 =
      GetApplicationReportRequest.newInstance(app2.getApplicationId());
  ApplicationReport report1 =
      rm1.getClientRMService().getApplicationReport(request1)
        .getApplicationReport();
  Assert.assertEquals("N/A", report1.getHost());
  Assert.assertEquals(-1, report1.getRpcPort());
}
 
Example 6
Source File: TestApplicationHistoryClientService.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testApplicationReport() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  GetApplicationReportRequest request =
      GetApplicationReportRequest.newInstance(appId);
  GetApplicationReportResponse response =
      clientService.getApplicationReport(request);
  ApplicationReport appReport = response.getApplicationReport();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
      .getMemorySeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
      .getVcoreSeconds());
  Assert.assertEquals("application_0_0001", appReport.getApplicationId()
    .toString());
  Assert.assertEquals("test app type",
      appReport.getApplicationType().toString());
  Assert.assertEquals("test queue", appReport.getQueue().toString());
}
 
Example 7
Source File: TestRMRestart.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private ApplicationReport verifyAppReportAfterRMRestart(RMApp app, MockRM rm)
    throws Exception {
  GetApplicationReportRequest reportRequest =
      GetApplicationReportRequest.newInstance(app.getApplicationId());
  GetApplicationReportResponse response =
      rm.getClientRMService().getApplicationReport(reportRequest);
  ApplicationReport report = response.getApplicationReport();
  Assert.assertEquals(app.getStartTime(), report.getStartTime());
  Assert.assertEquals(app.getFinishTime(), report.getFinishTime());
  Assert.assertEquals(app.createApplicationState(),
    report.getYarnApplicationState());
  Assert.assertTrue(1 == report.getProgress());
  return response.getApplicationReport();
}
 
Example 8
Source File: AHSClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportRequest request = GetApplicationReportRequest
      .newInstance(appId);
  GetApplicationReportResponse response = ahsClient
      .getApplicationReport(request);
  return response.getApplicationReport();
}
 
Example 9
Source File: TestRMRestart.java    From big-c with Apache License 2.0 5 votes vote down vote up
private ApplicationReport verifyAppReportAfterRMRestart(RMApp app, MockRM rm)
    throws Exception {
  GetApplicationReportRequest reportRequest =
      GetApplicationReportRequest.newInstance(app.getApplicationId());
  GetApplicationReportResponse response =
      rm.getClientRMService().getApplicationReport(reportRequest);
  ApplicationReport report = response.getApplicationReport();
  Assert.assertEquals(app.getStartTime(), report.getStartTime());
  Assert.assertEquals(app.getFinishTime(), report.getFinishTime());
  Assert.assertEquals(app.createApplicationState(),
    report.getYarnApplicationState());
  Assert.assertTrue(1 == report.getProgress());
  return response.getApplicationReport();
}
 
Example 10
Source File: AHSClientImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportRequest request = GetApplicationReportRequest
      .newInstance(appId);
  GetApplicationReportResponse response = ahsClient
      .getApplicationReport(request);
  return response.getApplicationReport();
}