Example usage for org.apache.hadoop.fs TestDFSIO TestDFSIO

List of usage examples for org.apache.hadoop.fs TestDFSIO TestDFSIO

Introduction

In this page you can find the example usage for org.apache.hadoop.fs TestDFSIO TestDFSIO.

Prototype

public TestDFSIO() 

Source Link

Usage

From source file:org.apache.whirr.service.hadoop.integration.benchmark.HadoopServiceTestDFSIOBenchmark.java

License:Apache License

@Test
public void test() throws Exception {
    // We use TestDFSIO's Tool interface so we can pass the configuration,
    // but this is only available after Hadoop 0.20.2
    // (https://issues.apache.org/jira/browse/MAPREDUCE-1832)
    // so we use a local copy of TestDFSIO with this patch
    int runs = Integer.parseInt(System.getProperty("testDFSIORuns", "3"));
    for (int i = 0; i < runs; i++) {
        LOG.info("Starting TestDFSIO run {} of {}", i + 1, runs);
        TestDFSIO testDFSIO = new TestDFSIO();
        JobConf jobConf = controller.getJobConf();
        jobConf.set("test.build.data", "/user/root/benchmark/TestDFSIO");
        testDFSIO.setConf(jobConf);//  ww w.ja va2 s.  c o  m
        testDFSIO.run("-write -nrFiles 10 -fileSize 1000".split(" "));
        testDFSIO.run("-read -nrFiles 10 -fileSize 1000".split(" "));
        testDFSIO.run(new String[] { "-clean" });
        LOG.info("Completed TestDFSIO run {} of {}", i + 1, runs);
    }
}