/** * We lost the task tracker! All task-tracker structures have already been updated. Just process * the contained tasks and any jobs that might be affected. */ void lostTaskTracker(String trackerName) { LOG.info("Lost tracker '" + trackerName + "'"); TreeSet lostTasks = (TreeSet) trackerToTaskMap.get(trackerName); trackerToTaskMap.remove(trackerName); if (lostTasks != null) { for (Iterator it = lostTasks.iterator(); it.hasNext(); ) { String taskId = (String) it.next(); TaskInProgress tip = (TaskInProgress) taskidToTIPMap.get(taskId); // Tell the job to fail the relevant task JobInProgress job = tip.getJob(); job.failedTask(tip, taskId, trackerName); } } }
/** Return a table of block data */ public Block[] getBlockReport() { TreeSet<Block> blockSet = new TreeSet<Block>(); volumes.getBlockInfo(blockSet); Block blockTable[] = new Block[blockSet.size()]; int i = 0; for (Iterator<Block> it = blockSet.iterator(); it.hasNext(); i++) { blockTable[i] = it.next(); } return blockTable; }
/** * A tracker wants to know if any of its Tasks have been closed (because the job completed, * whether successfully or not) */ public synchronized String pollForTaskWithClosedJob(String taskTracker) { TreeSet taskIds = (TreeSet) trackerToTaskMap.get(taskTracker); if (taskIds != null) { for (Iterator it = taskIds.iterator(); it.hasNext(); ) { String taskId = (String) it.next(); TaskInProgress tip = (TaskInProgress) taskidToTIPMap.get(taskId); if (tip.shouldCloseForClosedJob(taskId)) { // // This is how the JobTracker ends a task at the TaskTracker. // It may be successfully completed, or may be killed in // mid-execution. // return taskId; } } } return null; }