Example usage for org.apache.hadoop.mapreduce TaskAttemptContext getWorkingDirectory

List of usage examples for org.apache.hadoop.mapreduce TaskAttemptContext getWorkingDirectory

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce TaskAttemptContext getWorkingDirectory.

Prototype

public Path getWorkingDirectory() throws IOException;

Source Link

Document

Get the current working directory for the default file system.

Usage

From source file:com.bigdata.mapreduce.seqtotext.beta.ZipFileRecordReader.java

License:Apache License

/**
 * Initialise and open the ZIP file from the FileSystem
 *//*w  ww.  j a  va2 s .c om*/
@Override
public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext)
        throws IOException, InterruptedException {
    //      Configuration conf = new Configuration();
    //      conf.set("fs.defaultFS", "hdfs://training.musigma.com:8020/user/musigma/");
    FileSplit split = (FileSplit) inputSplit;
    System.out.println("the task attempt instance is : " + taskAttemptContext.getJobName());
    System.out.println("the task attempt instance is : " + taskAttemptContext.getWorkingDirectory().toString());
    Configuration conf = taskAttemptContext.getConfiguration();
    Path path = split.getPath();
    FileSystem fs = path.getFileSystem(conf);
    System.out.println("file system replication : " + fs.getDefaultReplication());
    // Open the stream
    fsin = fs.open(path);
    // zip = new ZipInputStream(fsin);
    tar = new TarInputStream(fsin);
    System.out.println("tar input stream is : " + tar.toString());
}