List of usage examples for org.apache.hadoop.mapred OutputCommitter cleanupJob
@Override @Deprecated public final void cleanupJob(org.apache.hadoop.mapreduce.JobContext context) throws IOException
From source file:com.ibm.jaql.io.hadoop.DefaultHadoopOutputAdapter.java
License:Apache License
public void close() throws Exception { if (writer != null) { writer.close((Reporter) reporter); writer = null;//w w w. j a va 2 s .com OutputCommitter committer = conf.getOutputCommitter(); committer.commitTask(sequentialTask); // FIXME: We skip the job cleanup because the FileOutputCommitter deletes the _temporary, which // is shared by all sequential jobs. committer.cleanupJob(sequentialJob); sequentialTask = null; // // if (committer instanceof FileOutputCommitter) { // // // for this case, only one file is expected // String fileName = new Path(location).getName(); // Path pTgt = null; // Path src = null; // try { // pTgt = FileOutputFormat.getOutputPath(conf); // src = FileOutputFormat.getTaskOutputPath(conf, fileName); // } catch(Exception e) { // // TODO: this can happen if the OutputFormat is not a FileOutputFormat, // // i.e., for HBase // LOG.warn("task output files not found"); // } // if(pTgt != null && src != null) { // Path tgt = new Path(FileOutputFormat.getOutputPath(conf), fileName); // // FileSystem fs = src.getFileSystem(conf); // if(fs.exists(tgt)) { // fs.delete(tgt, true); // } // // // // rename src to tgt // fs.rename(src, tgt); // // // clean-up the temp // Path tmp = new Path(FileOutputFormat.getOutputPath(conf), FileOutputCommitter.TEMP_DIR_NAME); // if(fs.exists(tmp)) // fs.delete(tmp, true); // } // } } }