Skip to content

Commit bd8f55c

Browse files
committed
Ensure we have enough slots for job cleanup
1 parent aacabf4 commit bd8f55c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/org/apache/hadoop/mapred/ResourcePolicy.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,20 @@ public void computeNeededSlots(List<JobInProgress> jobsInProgress,
7878
int pendingReduces = 0;
7979
int runningMaps = 0;
8080
int runningReduces = 0;
81+
8182
for (JobInProgress progress : jobsInProgress) {
8283
// JobStatus.pendingMaps/Reduces may return the wrong value on
8384
// occasion. This seems to be safer.
8485
pendingMaps += scheduler.getPendingTasks(progress.getTasks(TaskType.MAP));
8586
pendingReduces += scheduler.getPendingTasks(progress.getTasks(TaskType.REDUCE));
8687
runningMaps += progress.runningMaps();
8788
runningReduces += progress.runningReduces();
89+
90+
// If the task is waiting to launch the cleanup task, let us make sure we have
91+
// capacity to run the task.
92+
if (!progress.isCleanupLaunched()) {
93+
pendingMaps += scheduler.getPendingTasks(progress.getTasks(TaskType.JOB_CLEANUP));
94+
}
8895
}
8996

9097
// Mark active (heartbeated) TaskTrackers and compute idle slots.

0 commit comments

Comments
 (0)