Search in sources :

Example 1 with AHSClient

use of org.apache.hadoop.yarn.client.api.AHSClient in project hadoop by apache.

the class TestAHSClient method testGetApplicationAttempt.

@Test(timeout = 10000)
public void testGetApplicationAttempt() throws YarnException, IOException {
    Configuration conf = new Configuration();
    final AHSClient client = new MockAHSClient();
    client.init(conf);
    client.start();
    List<ApplicationReport> expectedReports = ((MockAHSClient) client).getReports();
    ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
    ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(applicationId, 1);
    ApplicationAttemptReport report = client.getApplicationAttemptReport(appAttemptId);
    Assert.assertNotNull(report);
    Assert.assertEquals(report.getApplicationAttemptId().toString(), expectedReports.get(0).getCurrentApplicationAttemptId().toString());
    client.stop();
}
Also used : ApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationReport) ApplicationAttemptReport(org.apache.hadoop.yarn.api.records.ApplicationAttemptReport) Configuration(org.apache.hadoop.conf.Configuration) AHSClient(org.apache.hadoop.yarn.client.api.AHSClient) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) Test(org.junit.Test)

Example 2 with AHSClient

use of org.apache.hadoop.yarn.client.api.AHSClient in project hadoop by apache.

the class TestAHSClient method testGetApplications.

@Test(timeout = 10000)
public void testGetApplications() throws YarnException, IOException {
    Configuration conf = new Configuration();
    final AHSClient client = new MockAHSClient();
    client.init(conf);
    client.start();
    List<ApplicationReport> expectedReports = ((MockAHSClient) client).getReports();
    List<ApplicationReport> reports = client.getApplications();
    Assert.assertEquals(reports, expectedReports);
    reports = client.getApplications();
    Assert.assertEquals(reports.size(), 4);
    client.stop();
}
Also used : ApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationReport) Configuration(org.apache.hadoop.conf.Configuration) AHSClient(org.apache.hadoop.yarn.client.api.AHSClient) Test(org.junit.Test)

Example 3 with AHSClient

use of org.apache.hadoop.yarn.client.api.AHSClient in project hadoop by apache.

the class TestAHSClient method testGetApplicationReport.

@Test(timeout = 10000)
public void testGetApplicationReport() throws YarnException, IOException {
    Configuration conf = new Configuration();
    final AHSClient client = new MockAHSClient();
    client.init(conf);
    client.start();
    List<ApplicationReport> expectedReports = ((MockAHSClient) client).getReports();
    ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
    ApplicationReport report = client.getApplicationReport(applicationId);
    Assert.assertEquals(report, expectedReports.get(0));
    Assert.assertEquals(report.getApplicationId().toString(), expectedReports.get(0).getApplicationId().toString());
    client.stop();
}
Also used : ApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationReport) Configuration(org.apache.hadoop.conf.Configuration) AHSClient(org.apache.hadoop.yarn.client.api.AHSClient) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) Test(org.junit.Test)

Example 4 with AHSClient

use of org.apache.hadoop.yarn.client.api.AHSClient in project hadoop by apache.

the class TestAHSClient method testGetContainers.

@Test(timeout = 10000)
public void testGetContainers() throws YarnException, IOException {
    Configuration conf = new Configuration();
    final AHSClient client = new MockAHSClient();
    client.init(conf);
    client.start();
    ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
    ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(applicationId, 1);
    List<ContainerReport> reports = client.getContainers(appAttemptId);
    Assert.assertNotNull(reports);
    Assert.assertEquals(reports.get(0).getContainerId(), (ContainerId.newContainerId(appAttemptId, 1)));
    Assert.assertEquals(reports.get(1).getContainerId(), (ContainerId.newContainerId(appAttemptId, 2)));
    client.stop();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ContainerReport(org.apache.hadoop.yarn.api.records.ContainerReport) AHSClient(org.apache.hadoop.yarn.client.api.AHSClient) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) Test(org.junit.Test)

Example 5 with AHSClient

use of org.apache.hadoop.yarn.client.api.AHSClient in project hadoop by apache.

the class TestAHSClient method testGetContainerReport.

@Test(timeout = 10000)
public void testGetContainerReport() throws YarnException, IOException {
    Configuration conf = new Configuration();
    final AHSClient client = new MockAHSClient();
    client.init(conf);
    client.start();
    List<ApplicationReport> expectedReports = ((MockAHSClient) client).getReports();
    ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
    ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(applicationId, 1);
    ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
    ContainerReport report = client.getContainerReport(containerId);
    Assert.assertNotNull(report);
    Assert.assertEquals(report.getContainerId().toString(), (ContainerId.newContainerId(expectedReports.get(0).getCurrentApplicationAttemptId(), 1)).toString());
    client.stop();
}
Also used : ApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationReport) Configuration(org.apache.hadoop.conf.Configuration) ContainerId(org.apache.hadoop.yarn.api.records.ContainerId) ContainerReport(org.apache.hadoop.yarn.api.records.ContainerReport) AHSClient(org.apache.hadoop.yarn.client.api.AHSClient) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) Test(org.junit.Test)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)7 AHSClient (org.apache.hadoop.yarn.client.api.AHSClient)7 Test (org.junit.Test)7 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)5 ApplicationReport (org.apache.hadoop.yarn.api.records.ApplicationReport)4 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)3 ApplicationAttemptReport (org.apache.hadoop.yarn.api.records.ApplicationAttemptReport)2 ContainerReport (org.apache.hadoop.yarn.api.records.ContainerReport)2 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)1