/** * Run the Gridmix job with given runtime arguments. * @param gridmixDir - Gridmix parent directory * @param conf - cluster configuration. * @param gridmixRunMode - gridmix run mode. * @param runtimeValues - gridmix runtime values. * @param otherArgs - gridmix other generic args. * @return - gridmix status either 0 or 1. * @throws Exception */ public static int runGridmixJob(Path gridmixDir, Configuration conf, int gridmixRunMode, String [] runtimeValues, String [] otherArgs) throws Exception { Path outputDir = new Path(gridmixDir, "gridmix"); Path inputDir = new Path(gridmixDir, "input"); LOG.info("Cleanup the data if data already exists."); switch (gridmixRunMode) { case GridMixRunMode.DATA_GENERATION : cleanup(inputDir, conf); cleanup(outputDir, conf); break; case GridMixRunMode.DATA_GENERATION_AND_RUN_GRIDMIX : cleanup(inputDir, conf); cleanup(outputDir, conf); break; case GridMixRunMode.RUN_GRIDMIX : cleanup(outputDir, conf); break; } final String [] args = UtilsForGridmix.getArgsList(gridmixDir, gridmixRunMode, runtimeValues, otherArgs); Gridmix gridmix = new Gridmix(); LOG.info("Submit a Gridmix job in " + runtimeValues[1] + " mode for " + GridMixRunMode.getMode(gridmixRunMode)); int exitCode = ToolRunner.run(conf, gridmix, args); return exitCode; }
private void verifyInputFiles(boolean isCompressed) throws IOException { List<String> inputFiles = getInputFiles(conf, Gridmix.getGridmixInputDataPath(gridmixDir)); for (String inputFile: inputFiles) { boolean fileStatus = (inputFile.contains(".gz") || inputFile.contains(".tgz"))? true : false; if (isCompressed) { Assert.assertTrue("Compressed input split file was not found.", fileStatus); } else { Assert.assertFalse("Uncompressed input split file was not found.", fileStatus); } } }
private void verifyInputDataSize(long INPUT_SIZE) throws IOException { long actDataSize = getInputDataSizeInMB(conf, Gridmix.getGridmixInputDataPath(gridmixDir)); double ratio = ((double)actDataSize)/INPUT_SIZE; long expDataSize = (long)(INPUT_SIZE * ratio); Assert.assertEquals("Generated data has not matched with given size.", expDataSize, actDataSize); }
/** * Run the Gridmix job with given runtime arguments. * @param gridmixDir - Gridmix parent directory * @param conf - cluster configuration. * @param gridmixRunMode - gridmix run mode. * @param runtimeValues - gridmix runtime values. * @param otherArgs - gridmix other generic args. * @return - gridmix status either 0 or 1. * @throws Exception */ public static int runGridmixJob(Path gridmixDir, Configuration conf, int gridmixRunMode, String [] runtimeValues, String [] otherArgs) throws Exception { Path outputDir = new Path(gridmixDir, "gridmix"); Path inputDir = new Path(gridmixDir, "input"); LOG.info("Cleanup the data if data already exists."); String modeName = new String(); switch (gridmixRunMode) { case 1 : cleanup(inputDir, conf); cleanup(outputDir, conf); modeName = GridMixRunMode.DATA_GENERATION.name(); break; case 2 : cleanup(outputDir, conf); modeName = GridMixRunMode.RUN_GRIDMIX.name(); break; case 3 : cleanup(inputDir, conf); cleanup(outputDir, conf); modeName = GridMixRunMode.DATA_GENERATION_AND_RUN_GRIDMIX.name(); break; } final String [] args = UtilsForGridmix.getArgsList(gridmixDir, gridmixRunMode, runtimeValues, otherArgs); Gridmix gridmix = new Gridmix(); LOG.info("Submit a Gridmix job in " + runtimeValues[1] + " mode for " + modeName); int exitCode = ToolRunner.run(conf, gridmix, args); return exitCode; }