Search in sources :

Example 1 with ClusterStats

use of org.apache.hadoop.mapred.gridmix.Statistics.ClusterStats in project hadoop by apache.

the class TestGridmixSummary method testClusterSummarizer.

/**
   * Test {@link ClusterSummarizer}.
   */
@Test
public void testClusterSummarizer() throws IOException {
    ClusterSummarizer cs = new ClusterSummarizer();
    Configuration conf = new Configuration();
    String jt = "test-jt:1234";
    String nn = "test-nn:5678";
    conf.set(JTConfig.JT_IPC_ADDRESS, jt);
    conf.set(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY, nn);
    cs.start(conf);
    assertEquals("JT name mismatch", jt, cs.getJobTrackerInfo());
    assertEquals("NN name mismatch", nn, cs.getNamenodeInfo());
    ClusterStats cStats = ClusterStats.getClusterStats();
    conf.set(JTConfig.JT_IPC_ADDRESS, "local");
    conf.set(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY, "local");
    JobClient jc = new JobClient(conf);
    cStats.setClusterMetric(jc.getClusterStatus());
    cs.update(cStats);
    // test
    assertEquals("Cluster summary test failed!", 1, cs.getMaxMapTasks());
    assertEquals("Cluster summary test failed!", 1, cs.getMaxReduceTasks());
    assertEquals("Cluster summary test failed!", 1, cs.getNumActiveTrackers());
    assertEquals("Cluster summary test failed!", 0, cs.getNumBlacklistedTrackers());
}
Also used : ClusterStats(org.apache.hadoop.mapred.gridmix.Statistics.ClusterStats) Configuration(org.apache.hadoop.conf.Configuration) JobClient(org.apache.hadoop.mapred.JobClient) Test(org.junit.Test)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)1 JobClient (org.apache.hadoop.mapred.JobClient)1 ClusterStats (org.apache.hadoop.mapred.gridmix.Statistics.ClusterStats)1 Test (org.junit.Test)1