code: public static Path getTaskOutputPath(JobConf conf, String name) 
    throws IOException {
      // ${mapred.out.dir}
      Path outputPath = getOutputPath(conf);
      if (outputPath == null) {
        throw new IOException("Undefined job output-path");
      }
  
      OutputCommitter committer = conf.getOutputCommitter();
      Path workPath = outputPath;
      TaskAttemptContext context = new TaskAttemptContext(conf,
                  TaskAttemptID.forName(conf.get("mapred.task.id")));
      if (committer instanceof FileOutputCommitter) {
        workPath = ((FileOutputCommitter)committer).getWorkPath(context,
                                                                outputPath);
      }
      
      // ${mapred.out.dir}/_temporary/_${taskid}/${name}
      return new Path(workPath, name);
    }
docs: Helper function to create the task's temporary output directory and
  return the path to the task's output file.
  
  @param conf job-configuration
  @param name temporary task-output filename
  @return path to the task's temporary output file
  @throws IOException