Move the files from the work directory to the job output directory
@param context the task context
163649
public void commitTask(TaskAttemptContext context) 
  throws IOException {
    TaskAttemptID attemptId = context.getTaskAttemptID();
    if (workPath != null) {
      context.progress();
      if (outputFileSystem.exists(workPath)) {
        // Move the task outputs to their final place
        moveTaskOutputs(context, outputFileSystem, outputPath, workPath);
        // Delete the temporary task-specific output directory
        if (!outputFileSystem.delete(workPath, true)) {
          LOG.warn("Failed to delete the temporary output" + 
          " directory of task: " + attemptId + " - " + workPath);
        }
        LOG.info("Saved output of task '" + attemptId + "' to " + 
                 outputPath);
      }
    }
  }
1141497
public static void cleanUp(Context context) {
    File path = getScreenshotFolder(context);
    if (!path.exists()) {
      return;
    }

    delete(path);
  }
458740
public void execute(NodeTaskContext context) {
    NodeTaskReporter taskReporter = new NodeTaskReporter(this);
    taskQueue = new ArrayDeque<>(tasks);
    if (!taskQueue.isEmpty()) {
      NodeTask task = taskQueue.poll();
      task.execute(context, taskReporter);
    }
    else { // if the queue is empty, reports that the pipeline execution was a success
      listener.onSuccess();
    }
  }
1178232
public Path getDefaultWorkFile(TaskAttemptContext context,
                                 String extension) throws IOException{
    FileOutputCommitter committer = 
      (FileOutputCommitter) getOutputCommitter(context);
    return new Path(committer.getWorkPath(), getUniqueFile(context, "part", 
                                                           extension));
  }
46220
@Override
  @Deprecated
  public final void cleanupJob(org.apache.hadoop.mapreduce.JobContext context
                               ) throws IOException {
    cleanupJob((JobContext) context);
  }
825867
public void copyLatexOutputToOutputFolder( File texFile, File tempDirectory, File outputDirectory )
        throws MojoExecutionException, MojoFailureException
    {
        WildcardFileFilter fileFilter = new WildcardFileFilter( getFilesToCopy( texFile, LATEX_OUTPUT_FILES ) );
        copyLatexOutputToOutputFolder( texFile, tempDirectory, outputDirectory, fileFilter );
    }
537201
public void run(Context context) throws IOException, InterruptedException {
    setup(context);
    while (context.nextKey()) {
      context.progress();
      reduce(context.getCurrentKey(), context.getValues(), context);
    }
    cleanup(context);
  }
57943
public Output compile(Context context) throws CompilationException {
    Objects.requireNonNull(context, "Parameter context must not be null");

    if (context instanceof FileContext) {
      return compile((FileContext) context);
    }

    if (context instanceof StringContext) {
      return compile((StringContext) context);
    }

    throw new UnsupportedContextException(context);
  }
391487
protected void initContextContainer(JobExecutionContext jobExecutionContext) {

    JobContext jobContext = new JobContext();
    jobContext.addQuartzContext(jobExecutionContext);
    contextContainer.set(jobContext);
  }
203791
public static void toFile(String templateFileName, VelocityContext context, String destPath) {
		assertInit();

		toFile(Velocity.getTemplate(templateFileName), context, destPath);
	}
866576
function DownloadFileJob(options, context, taskId) {
        var self = this;
        DownloadFileJob.super_.call(self, logger, options, context, taskId);

        self.nodeId = self.context.target;
        if (self.options.filePath) {
            self.options.filePath = self.options.filePath.trim();
            if (_.last(self.options.filePath) === '/') {
                self.options.filePath = self.options.filePath.substring(0, self.options.filePath.length - 1);
            }
        }
    }
226248
@Override
	public void setup(TaskContext<GroupCombineFunction<IN, OUT>, OUT> context) {
		this.taskContext = context;
	}
1265731
private void performCopytoTask(final Map<FileInfo, FileInfo> copyToMap) {
        for (final Map.Entry<FileInfo, FileInfo> entry : copyToMap.entrySet()) {
            final URI copytoTarget = entry.getKey().uri;
            final URI copytoSource = entry.getValue().uri;
            final URI srcFile = job.tempDirURI.resolve(copytoSource);
            final URI targetFile = job.tempDirURI.resolve(copytoTarget);

            if (new File(targetFile).exists()) {
                logger.warn(MessageUtils.getMessage("DOTX064W", copytoTarget.getPath()).toString());
            } else {
                final FileInfo input = job.getFileInfo(fi -> fi.isInput).iterator().next();
                final URI inputMapInTemp = job.tempDirURI.resolve(input.uri);
                copyFileWithPIReplaced(srcFile, targetFile, copytoTarget, inputMapInTemp);
                // add new file info into job
                final FileInfo src = job.getFileInfo(copytoSource);
                assert src != null;
                final FileInfo dst = job.getFileInfo(copytoTarget);
                assert dst != null;
                final URI dstTemp = tempFileNameScheme.generateTempFileName(dst.result);
                final FileInfo res = new FileInfo.Builder(src)
                        .result(dst.result)
                        .uri(dstTemp)
                        .build();
                job.add(res);
            }
        }
    }
1103196
public void setContext(Context context) {
        log = Log.instance(context);
        options = Options.instance(context);
        classLoaderClass = options.get("procloader");
        locations.update(log, options, Lint.instance(context), FSInfo.instance(context));
    }
14080
protected void pushContext() {
    antOut = System.out;
    antErr = System.err;
    System.setOut(new PrintStream(out));
    System.setErr(out == err ? System.out : new PrintStream(err));
  }
544047
private String getTaskCacheDirectory(TaskControllerContext context) {
    // In the case of JVM reuse, the task specific directory
    // is different from what is set with respect with
    // env.workDir. Hence building this from the taskId everytime.
    String taskId = context.task.getTaskID().toString();
    File cacheDirForJob = context.env.workDir.getParentFile().getParentFile();
    if(context.task.isTaskCleanupTask()) {
      taskId = taskId + TaskTracker.TASK_CLEANUP_SUFFIX;
    }
    return new File(cacheDirForJob, taskId).getAbsolutePath(); 
  }
1237420
private void setupTaskCacheFileAccess(TaskControllerContext context) {
    String taskId = context.task.getTaskID().toString();
    JobID jobId = JobID.forName(getJobId(context));
    //Change permission for the task across all the disks
    for(String localDir : mapredLocalDirs) {
      File f = new File(localDir);
      File taskCacheDir = new File(f,TaskTracker.getLocalTaskDir(
          jobId.toString(), taskId, context.task.isTaskCleanupTask()));
      if(taskCacheDir.exists()) {
        changeDirectoryPermissions(taskCacheDir.getPath(), 
            FILE_PERMISSIONS, true);
      }          
    }//end of local directory Iteration 
  }