Example #1
0
    private TaskAttemptContext getContext(String namedOutput, TaskAttemptContext baseContext)
        throws IOException {
      Job job = getJob(baseContext.getJobID(), namedOutput, baseContext.getConfiguration());
      configureJob(namedOutput, job, outputs.get(namedOutput));

      return getTaskContext(baseContext, job);
    }
Example #2
0
 public static OutputCommitter getOutputCommitter(TaskAttemptContext tac)
     throws IOException, InterruptedException {
   Map<String, OutputConfig> outputs = getNamedOutputs(tac.getConfiguration());
   Map<String, OutputCommitter> committers = Maps.newHashMap();
   for (Map.Entry<String, OutputConfig> e : outputs.entrySet()) {
     String namedOutput = e.getKey();
     Job job = getJob(tac.getJobID(), e.getKey(), tac.getConfiguration());
     OutputFormat fmt = getOutputFormat(namedOutput, job, e.getValue());
     TaskAttemptContext taskContext = getTaskContext(tac, job);
     OutputCommitter oc = fmt.getOutputCommitter(taskContext);
     committers.put(namedOutput, oc);
   }
   return new CompositeOutputCommitter(outputs, committers);
 }