Search in sources :

Example 6 with GetApplicationAttemptReportResponse

use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse in project hadoop by apache.

the class TestApplicationHistoryClientService method testApplicationAttemptNotFound.

@Test
public void testApplicationAttemptNotFound() throws IOException, YarnException {
    ApplicationId appId = ApplicationId.newInstance(0, 1);
    ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId, MAX_APPS + 1);
    GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.newInstance(appAttemptId);
    try {
        @SuppressWarnings("unused") GetApplicationAttemptReportResponse response = clientService.getApplicationAttemptReport(request);
        Assert.fail("Exception should have been thrown before we reach here.");
    } catch (ApplicationAttemptNotFoundException e) {
        //This Exception is expected
        System.out.println(e.getMessage());
        Assert.assertTrue(e.getMessage().contains("doesn't exist in the timeline store"));
    } catch (Exception e) {
        Assert.fail("Undesired exception caught");
    }
}
Also used : GetApplicationAttemptReportRequest(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest) GetApplicationAttemptReportResponse(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) ContainerNotFoundException(org.apache.hadoop.yarn.exceptions.ContainerNotFoundException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) IOException(java.io.IOException) ApplicationAttemptNotFoundException(org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException) ApplicationNotFoundException(org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException) ApplicationAttemptNotFoundException(org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException) Test(org.junit.Test)

Example 7 with GetApplicationAttemptReportResponse

use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse in project hadoop by apache.

the class MockResourceManagerFacade method getApplicationAttemptReport.

@Override
public GetApplicationAttemptReportResponse getApplicationAttemptReport(GetApplicationAttemptReportRequest request) throws YarnException, IOException {
    GetApplicationAttemptReportResponse response = Records.newRecord(GetApplicationAttemptReportResponse.class);
    ApplicationAttemptReport report = Records.newRecord(ApplicationAttemptReport.class);
    report.setApplicationAttemptId(request.getApplicationAttemptId());
    report.setYarnApplicationAttemptState(YarnApplicationAttemptState.LAUNCHED);
    response.setApplicationAttemptReport(report);
    return response;
}
Also used : ApplicationAttemptReport(org.apache.hadoop.yarn.api.records.ApplicationAttemptReport) GetApplicationAttemptReportResponse(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse)

Aggregations

GetApplicationAttemptReportResponse (org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse)7 GetApplicationAttemptReportRequest (org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest)5 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)4 ApplicationNotFoundException (org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException)4 ApplicationAttemptReport (org.apache.hadoop.yarn.api.records.ApplicationAttemptReport)3 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)3 Test (org.junit.Test)3 IOException (java.io.IOException)2 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)2 ApplicationAttemptNotFoundException (org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException)2 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1 ContainerNotFoundException (org.apache.hadoop.yarn.exceptions.ContainerNotFoundException)1 RecordFactory (org.apache.hadoop.yarn.factories.RecordFactory)1 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)1 RMAppAttempt (org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt)1