public final boolean updateJobDurationInfo(final JobDurationInfoClass info) { // System.out.println("Adding job " + info.getJobID() + " with " // + info.getTasks(TaskType.MAP).size() + " map tasks"); TaskType type = info.getType(); Set<JobDurationInfoClass> jdis = (type == TaskType.MAP) ? this.mapJobDurationInfos : this.reduceJobDurationInfos; if (!jdis.contains(info)) return false; jdis.remove(info); boolean res = jdis.add(info); if (!res) return res; List<TaskDurationInfoClass> slots = this.cluster.getSlots(type); for (int i = 0; i < slots.size(); i++) { TaskDurationInfoClass slot = slots.get(i); if (slot != null && slot.getTaskID().getJobID().equals(info.getJobID())) { this.cluster.freeSlot(type, i); } } this.schedule(type); return res; }
public final boolean addJobDurationInfo(final JobDurationInfoClass info) { // System.out.println("Adding job " + info.getJobID() + " with " // + info.getTasks(TaskType.MAP).size() + " map tasks"); TaskType type = info.getType(); boolean res = (type == TaskType.MAP) ? this.mapJobDurationInfos.add(info) : this.reduceJobDurationInfos.add(info); if (!res) return res; // nothing changed this.schedule(type); return res; }