/** * Verify if the obtainXXX methods of {@link ParsedJob}, {@link ParsedTask} and {@link * ParsedTaskAttempt} give valid info */ private void validateParsedJob( ParsedJob parsedJob, int numMaps, int numReduces, String queueName) { validateParsedJobAPI(parsedJob, numMaps, numReduces, queueName); List<ParsedTask> maps = parsedJob.obtainMapTasks(); for (ParsedTask task : maps) { validateParsedTask(task); } List<ParsedTask> reduces = parsedJob.obtainReduceTasks(); for (ParsedTask task : reduces) { validateParsedTask(task); } List<ParsedTask> others = parsedJob.obtainOtherTasks(); for (ParsedTask task : others) { validateParsedTask(task); } }
/** Verify if the obtainXXX methods of {@link ParsedJob} give valid info */ private void validateParsedJobAPI( ParsedJob parsedJob, int numMaps, int numReduces, String queueName) { LOG.info("Validating ParsedJob.obtainXXX api... for " + parsedJob.getJobID()); assertNotNull("Job acls in ParsedJob is null", parsedJob.obtainJobAcls()); assertNotNull("Job conf path in ParsedJob is null", parsedJob.obtainJobConfpath()); assertEquals("Job queue in ParsedJob is wrong", queueName, parsedJob.getQueue()); assertNotNull("Map Counters in ParsedJob is null", parsedJob.obtainMapCounters()); assertNotNull("Reduce Counters in ParsedJob is null", parsedJob.obtainReduceCounters()); assertNotNull("Total Counters in ParsedJob is null", parsedJob.obtainTotalCounters()); assertNotNull("Map Tasks List in ParsedJob is null", parsedJob.obtainMapTasks()); assertNotNull("Reduce Tasks List in ParsedJob is null", parsedJob.obtainReduceTasks()); assertNotNull("Other Tasks List in ParsedJob is null", parsedJob.obtainOtherTasks()); // 1 map and 1 reduce task should be there assertEquals( "Number of map tasks in ParsedJob is wrong", numMaps, parsedJob.obtainMapTasks().size()); assertEquals( "Number of reduce tasks in ParsedJob is wrong", numReduces, parsedJob.obtainReduceTasks().size(), 1); assertTrue("Total Counters in ParsedJob is empty", parsedJob.obtainTotalCounters().size() > 0); // Current 0.20 history files contain job-level-map-counters and // job-level-reduce-counters. Older 0.20 history files may not have them. assertTrue("Map Counters in ParsedJob is empty", parsedJob.obtainMapCounters().size() > 0); assertTrue( "Reduce Counters in ParsedJob is empty", parsedJob.obtainReduceCounters().size() > 0); }