private void initTrackersToTasksMap ( Collection < JobInProgress > jobsInProgress ) { for ( TaskTrackerStatus tracker : taskTrackersDetails ) { taskTrackerExtendedTasks . put ( tracker . getTrackerName ( ) , new ArrayList < TaskStatus > ( ) ) ; } for ( JobInProgress job : jobsInProgress ) { total_map_tasks += job . getTasks ( TaskType . MAP ) . length ; total_reduce_tasks += job . getTasks ( TaskType . REDUCE ) . length ; for ( TaskInProgress task : job . getTasks ( TaskType . REDUCE ) ) { TaskStatus [ ] taskStatuses = task . getTaskStatuses ( ) ; for ( TaskStatus status : taskStatuses ) { Collection < TaskStatus > trackerTasks = taskTrackerExtendedTasks . get ( status . getTaskTracker ( ) ) ; if ( trackerTasks == null ) { trackerTasks = new ArrayList < TaskStatus > ( ) ; taskTrackerExtendedTasks . put ( status . getTaskTracker ( ) , trackerTasks ) ; } trackerTasks . add ( status ) ; } } for ( TaskInProgress task : job . getTasks ( TaskType . MAP ) ) { TaskStatus [ ] taskStatuses = task . getTaskStatuses ( ) ; for ( TaskStatus status : taskStatuses ) { Collection < TaskStatus > trackerTasks = taskTrackerExtendedTasks . get ( status . getTaskTracker ( ) ) ; if ( trackerTasks == null ) { trackerTasks = new ArrayList < TaskStatus > ( ) ; taskTrackerExtendedTasks . put ( status . getTaskTracker ( ) , trackerTasks ) ; } trackerTasks . add ( status ) ; } } } }
Goes through the list of TaskStatus objects for each of the running jobs on the cluster and associates them with the name of the task tracker they are or were running on .