Example usage for org.apache.hadoop.mapreduce TaskID getJobID

List of usage examples for org.apache.hadoop.mapreduce TaskID getJobID

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce TaskID getJobID.

Prototype

public JobID getJobID() 

Source Link

Document

Returns the JobID object that this tip belongs to.

Usage

From source file:org.terrier.indexing.AbstractHadoopIndexer.java

License:Mozilla Public License

public void deleteTaskFiles(String path, JobID job) {
    String[] fileNames = Files.list(path);

    if (fileNames == null)
        return;//from   w  ww .j  a va 2 s  .c  o m

    for (String filename : fileNames) {
        String periodParts[] = filename.split("\\.");

        try {
            TaskID tid = TaskID.forName(periodParts[0]);

            if (tid.getJobID().compareTo(job) == 0) {
                if (!Files.delete(path + "/" + filename))
                    logger.warn("Could not delete temporary map side-effect file " + path + "/" + filename);
            }
        } catch (Exception e) {
        }

        //remove any empty reduce files created as a side effect of using sequencefileoutputformat rather than nulloutputformat
        if (filename.startsWith("part-r-"))
            Files.delete(path + "/" + filename);
    }
}