/** * Have all the tasks of type specified by isMap finished in this job? * * @param jip * @param isMap * @return true if finished, false otherwise */ static boolean haveAllTasksFinished(JobInProgress jip, boolean isMap) { return ((isMap ? jip.runningMaps() : jip.runningReduces()) == 0); }
/** * Make sure that the number of tasks of type specified by isMap running in * the given job is the same as noOfTasksToBeRunning * * <p> * * TODO: It should eventually use a JobID and then get the information from * the JT to check the number of running tasks. * * @param jip * @param isMap * @param noOfTasksToBeRunning */ static void assertNumTasksRunning(JobInProgress jip, boolean isMap, int noOfTasksToBeRunning) throws Exception { if ((isMap ? jip.runningMaps() : jip.runningReduces()) != noOfTasksToBeRunning) { throw new Exception("Number of tasks running is not " + noOfTasksToBeRunning); } }
/** * Wait till noOfTasksToBeRunning number of tasks of type specified by isMap * started running. This currently uses a jip object and directly uses its api * to determine the number of tasks running. * * <p> * * TODO: It should eventually use a JobID and then get the information from * the JT to check the number of running tasks. * * @param jip * @param isMap * @param noOfTasksToBeRunning */ static void waitTillNTasksStartRunning(JobInProgress jip, boolean isMap, int noOfTasksToBeRunning) throws InterruptedException { int numTasks = 0; while (numTasks != noOfTasksToBeRunning) { Thread.sleep(1000); numTasks = isMap ? jip.runningMaps() : jip.runningReduces(); LOG.info("Waiting till " + noOfTasksToBeRunning + (isMap ? " map" : " reduce") + " tasks of the job " + jip.getJobID() + " start running. " + numTasks + " tasks already started running."); } }
if (isRunning) { totalRunningMaps += job.runningMaps(); totalRunningReduces += job.runningReduces(); (isRunning) ? job.runningMaps() + "</td><td>" : ""; String runningReduceTableData = (isRunning) ? job.runningReduces() + "</td><td>" : "";
if (isRunning) { totalRunningMaps += job.runningMaps(); totalRunningReduces += job.runningReduces(); (isRunning) ? job.runningMaps() + "</td><td>" : ""; String runningReduceTableData = (isRunning) ? "</td><td>" + job.runningReduces() : "";
static void checkTaskCounts(JobInProgress jip, int runningMaps, int pendingMaps, int runningReduces, int pendingReduces) { Counters counter = jip.getJobCounters(); long totalTaskCount = counter.getCounter(JobCounter.TOTAL_LAUNCHED_MAPS) + counter.getCounter(JobCounter.TOTAL_LAUNCHED_REDUCES); LOG.info("totalTaskCount is " + totalTaskCount); LOG.info(" Running Maps:" + jip.runningMaps() + " Pending Maps:" + jip.pendingMaps() + " Running Reds:" + jip.runningReduces() + " Pending Reds:" + jip.pendingReduces()); assertEquals(jip.getNumTaskCompletionEvents(),totalTaskCount); assertEquals(runningMaps, jip.runningMaps()); assertEquals(pendingMaps, jip.pendingMaps()); assertEquals(runningReduces, jip.runningReduces()); assertEquals(pendingReduces, jip.pendingReduces()); }
pendingReduces += scheduler.getPendingTasks(progress.getTasks(TaskType.REDUCE)); runningMaps += progress.runningMaps(); runningReduces += progress.runningReduces();
&& (job.runningMaps() + job.runningReduces() >= maxTasksPerJob)) { continue;
&& (job.runningMaps() + job.runningReduces() >= maxTasksPerJob)) { continue;
&& (job.runningMaps() + job.runningReduces() >= maxTasksPerJob)) { continue;