Example usage for org.apache.hadoop.fs FileSystem newInstanceLocal

List of usage examples for org.apache.hadoop.fs FileSystem newInstanceLocal

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FileSystem newInstanceLocal.

Prototype

public static LocalFileSystem newInstanceLocal(Configuration conf) throws IOException 

Source Link

Document

Get a unique local FileSystem object.

Usage

From source file:com.netflix.bdp.inviso.history.TraceJobHistoryLoader.java

License:Apache License

public static void main(String[] args) throws Exception {
    FileSystem fs = FileSystem.newInstanceLocal(new Configuration());

    JobHistoryParser parser = new JobHistoryParser(fs, "/tmp/job_1405808155709_124465.history");

    //JobInfo jobInfo = parser.parse();
    TraceJobHistoryLoader loader = new TraceJobHistoryLoader(new PropertiesConfiguration());
    parser.parse(loader);// w  w  w. j  a  v a2 s. c  o m

    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(Feature.INDENT_OUTPUT, true);
    mapper.writeValue(new File("/tmp/mr2-hist.json"), loader.getJob());
}

From source file:org.apache.gobblin.yarn.GobblinYarnLogSource.java

License:Apache License

/**
 * Return a new (non-cached) {@link FileSystem} instance. The {@link FileSystem} instance
 * returned by the method has automatic closing disabled. The user of the instance needs to handle closing of the
 * instance, typically as part of its shutdown sequence.
 *//*from ww  w.j a va2 s.co m*/
private FileSystem buildFileSystem(Config config, boolean isLocal) throws IOException {
    return isLocal ? FileSystem.newInstanceLocal(AUTO_CLOSE_CONFIG)
            : config.hasPath(ConfigurationKeys.FS_URI_KEY)
                    ? FileSystem.newInstance(URI.create(config.getString(ConfigurationKeys.FS_URI_KEY)),
                            AUTO_CLOSE_CONFIG)
                    : FileSystem.newInstance(AUTO_CLOSE_CONFIG);
}

From source file:org.shaf.core.util.IOUtils.java

License:Apache License

/**
 * Returns the {@link FileSystem}.// www  .j a  va  2s  . c  om
 * 
 * @return the file system.
 * @throws IOException
 *             if an I/O error occurs.
 */
public static final FileSystem getFileSystem() throws IOException {
    if (isHadoopAvailable()) {
        return FileSystem.newInstance(getHadoopConfig());
    } else {
        return FileSystem.newInstanceLocal(new Configuration()).getRaw();
    }
}

From source file:org.shaf.core.util.IOUtils.java

License:Apache License

/**
 * Returns the local {@link FileSystem}.
 * /*from  www .j a v a2s.c  o m*/
 * @return the local file system.
 * @throws IOException
 *             if an I/O error occurs.
 */
public static final FileSystem getLocalFileSystem() throws IOException {
    return FileSystem.newInstanceLocal(new Configuration()).getRaw();
}