/** * Get the level of locality that a given task would have if launched on * a particular TaskTracker. Returns 0 if the task has data on that machine, * 1 if it has data on the same rack, etc (depending on number of levels in * the network hierarchy). */ int getLocalityLevel(TaskInProgress tip, TaskTrackerStatus tts) { Node tracker = jobtracker.getNode(tts.getHost()); int level = this.maxLevel; // find the right level across split locations for (String local : maps[tip.getIdWithinJob()].getSplitLocations()) { Node datanode = jobtracker.getNode(local); int newLevel = this.maxLevel; if (tracker != null && datanode != null) { newLevel = getMatchingLevelForNodes(tracker, datanode); } if (newLevel < level) { level = newLevel; // an optimization if (level == 0) { break; } } } return level; }
/** * Get the level of locality that a given task would have if launched on * a particular TaskTracker. Returns 0 if the task has data on that machine, * 1 if it has data on the same rack, etc (depending on number of levels in * the network hierarchy). */ int getLocalityLevel(TaskInProgress tip, TaskTrackerStatus tts) { Node tracker = jobtracker.getNode(tts.getHost()); int level = this.maxLevel; // find the right level across split locations for (String local : maps[tip.getIdWithinJob()].getSplitLocations()) { Node datanode = jobtracker.getNode(local); int newLevel = this.maxLevel; if (tracker != null && datanode != null) { newLevel = getMatchingLevelForNodes(tracker, datanode); } if (newLevel < level) { level = newLevel; // an optimization if (level == 0) { break; } } } return level; }
int newLevel = this.maxLevel; if (tracker != null && datanode != null) { newLevel = getMatchingLevelForNodes(tracker, datanode);
int newLevel = this.maxLevel; if (tracker != null && datanode != null) { newLevel = getMatchingLevelForNodes(tracker, datanode);