public synchronized void unreserveTaskTracker(TaskTracker taskTracker, TaskType type) { Map<TaskTracker, FallowSlotInfo> map = (type == TaskType.MAP) ? trackersReservedForMaps : trackersReservedForReduces; FallowSlotInfo info = map.get(taskTracker); if (info == null) { LOG.warn("Cannot find information about fallow slots for " + taskTracker.getTrackerName()); return; } long now = System.currentTimeMillis(); Enum<JobCounter> counter = (type == TaskType.MAP) ? JobCounter.FALLOW_SLOTS_MILLIS_MAPS : JobCounter.FALLOW_SLOTS_MILLIS_REDUCES; long fallowSlotMillis = (now - info.getTimestamp()) * info.getNumSlots(); jobCounters.incrCounter(counter, fallowSlotMillis); map.remove(taskTracker); if (type == TaskType.MAP) { jobtracker.getInstrumentation().decReservedMapSlots(info.getNumSlots()); } else { jobtracker.getInstrumentation().decReservedReduceSlots( info.getNumSlots()); } jobtracker.decrementReservations(type, info.getNumSlots()); }
public synchronized void unreserveTaskTracker(TaskTracker taskTracker, TaskType type) { Map<TaskTracker, FallowSlotInfo> map = (type == TaskType.MAP) ? trackersReservedForMaps : trackersReservedForReduces; FallowSlotInfo info = map.get(taskTracker); if (info == null) { LOG.warn("Cannot find information about fallow slots for " + taskTracker.getTrackerName()); return; } long now = JobTracker.getClock().getTime(); Enum<Counter> counter = (type == TaskType.MAP) ? Counter.FALLOW_SLOTS_MILLIS_MAPS : Counter.FALLOW_SLOTS_MILLIS_REDUCES; long fallowSlotMillis = (now - info.getTimestamp()) * info.getNumSlots(); jobCounters.incrCounter(counter, fallowSlotMillis); map.remove(taskTracker); if (type == TaskType.MAP) { jobtracker.getInstrumentation().decReservedMapSlots(info.getNumSlots()); } else { jobtracker.getInstrumentation().decReservedReduceSlots( info.getNumSlots()); } jobtracker.decrementReservations(type, info.getNumSlots()); }