Example usage for org.apache.hadoop.mapred FileOutputFormat setWorkOutputPath

List of usage examples for org.apache.hadoop.mapred FileOutputFormat setWorkOutputPath

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred FileOutputFormat setWorkOutputPath.

Prototype

@Private
public static void setWorkOutputPath(JobConf conf, Path outputDir) 

Source Link

Document

Set the Path of the task's temporary output directory for the map-reduce job.

Usage

From source file:org.apache.tez.mapreduce.output.MROutput.java

License:Apache License

public void initCommitter(JobConf job, boolean useNewApi) throws IOException, InterruptedException {

    if (useNewApi) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("using new api for output committer");
        }//  ww  w  . j av a 2 s  .  c om

        this.committer = newOutputFormat.getOutputCommitter(newApiTaskAttemptContext);
    } else {
        this.committer = job.getOutputCommitter();
    }

    Path outputPath = FileOutputFormat.getOutputPath(job);
    if (outputPath != null) {
        if ((this.committer instanceof FileOutputCommitter)) {
            FileOutputFormat.setWorkOutputPath(job,
                    ((FileOutputCommitter) this.committer).getTaskAttemptPath(oldApiTaskAttemptContext));
        } else {
            FileOutputFormat.setWorkOutputPath(job, outputPath);
        }
    }
    if (useNewApi) {
        this.committer.setupTask(newApiTaskAttemptContext);
    } else {
        this.committer.setupTask(oldApiTaskAttemptContext);
    }
}

From source file:org.apache.tez.mapreduce.processor.MRTask.java

License:Apache License

public void localizeConfiguration(JobConf jobConf) throws IOException, InterruptedException {
    jobConf.set(JobContext.TASK_ID, taskAttemptId.getTaskID().toString());
    jobConf.set(JobContext.TASK_ATTEMPT_ID, taskAttemptId.toString());
    jobConf.setInt(JobContext.TASK_PARTITION, taskAttemptId.getTaskID().getId());
    jobConf.set(JobContext.ID, taskAttemptId.getJobID().toString());

    jobConf.setBoolean(MRJobConfig.TASK_ISMAP, isMap);

    Path outputPath = FileOutputFormat.getOutputPath(jobConf);
    if (outputPath != null) {
        if ((committer instanceof FileOutputCommitter)) {
            FileOutputFormat.setWorkOutputPath(jobConf,
                    ((FileOutputCommitter) committer).getTaskAttemptPath(taskAttemptContext));
        } else {//from   w w w.  j a  va2  s .c o m
            FileOutputFormat.setWorkOutputPath(jobConf, outputPath);
        }
    }
}