code: private String getDirectoryChosenForTask(File directory,
        TaskControllerContext context) {
      String jobId = getJobId(context);
      String taskId = context.task.getTaskID().toString();
      for (String dir : mapredLocalDirs) {
        File mapredDir = new File(dir);
        File taskDir = new File(mapredDir, TaskTracker.getLocalTaskDir(
            jobId, taskId, context.task.isTaskCleanupTask()));
        if (directory.equals(taskDir)) {
          return dir;
        }
      }
      
      LOG.error("Couldn't parse task cache directory correctly");
      throw new IllegalArgumentException("invalid task cache directory "
                  + directory.getAbsolutePath());
    }
docs: this task.