code: public Task obtainJobCleanupTask(TaskTrackerStatus tts,
                                               int clusterSize,
                                               int numUniqueHosts,
                                               boolean isMapSlot
                                              ) throws IOException {
      if(!tasksInited.get() || !jobSetupCleanupNeeded) {
        return null;
      }
  
      synchronized(this) {
        if (!canLaunchJobCleanupTask()) {
          return null;
        }
  
        String taskTracker = tts.getTrackerName();
        // Update the last-known clusterSize
        this.clusterSize = clusterSize;
        if (!shouldRunOnTaskTracker(taskTracker)) {
          return null;
        }
  
        List<TaskInProgress> cleanupTaskList = new ArrayList<TaskInProgress>();
        if (isMapSlot) {
          cleanupTaskList.add(cleanup[0]);
        } else {
          cleanupTaskList.add(cleanup[1]);
        }
        TaskInProgress tip = findTaskFromList(cleanupTaskList,
                               tts, numUniqueHosts, false);
        if (tip == null) {
          return null;
        }
  
        // Now launch the cleanupTask
        Task result = tip.getTaskToRun(tts.getTrackerName());
  
        if (result != null) {
          addRunningTaskToTIP(tip, result.getTaskID(), tts, true);
          if (jobFailed) {
            result.setJobCleanupTaskState
            (org.apache.hadoop.mapreduce.JobStatus.State.FAILED);
          } else if (jobKilled) {
            result.setJobCleanupTaskState
            (org.apache.hadoop.mapreduce.JobStatus.State.KILLED);
          } else {
            result.setJobCleanupTaskState
            (org.apache.hadoop.mapreduce.JobStatus.State.SUCCEEDED);
          }
        }
        return result;
      }
  
    }
docs: Return a CleanupTask, if appropriate, to run on the given tasktracker