Example usage for org.apache.hadoop.fs LocalFileSystem mkdirs

List of usage examples for org.apache.hadoop.fs LocalFileSystem mkdirs

Introduction

In this page you can find the example usage for org.apache.hadoop.fs LocalFileSystem mkdirs.

Prototype

@Override
    public boolean mkdirs(Path f) throws IOException 

Source Link

Usage

From source file:com.hazelcast.jet.connector.hadoop.WriteHdfsPTest.java

License:Open Source License

public Path getPath() throws IOException {
    LocalFileSystem local = FileSystem.getLocal(new Configuration());
    Path path = new Path(randomString());
    local.mkdirs(path);
    local.deleteOnExit(path);// w w w .  j  ava2s  .c o m
    return path;
}

From source file:org.apache.accumulo.server.ServerConstantsTest.java

License:Apache License

private ArrayList<String> init(File newFile, List<String> uuids, List<Integer> dataVersions)
        throws IllegalArgumentException, IOException {
    String base = newFile.toURI().toString();

    LocalFileSystem fs = FileSystem.getLocal(new Configuration());

    ArrayList<String> accumuloPaths = new ArrayList<>();

    for (int i = 0; i < uuids.size(); i++) {
        String volume = "v" + i;

        String accumuloPath = base + "/" + volume + "/accumulo";
        accumuloPaths.add(accumuloPath);

        if (uuids.get(i) != null) {
            fs.mkdirs(new Path(accumuloPath + "/" + ServerConstants.INSTANCE_ID_DIR));
            fs.createNewFile(/*  w w w .j a va2 s . c  o  m*/
                    new Path(accumuloPath + "/" + ServerConstants.INSTANCE_ID_DIR + "/" + uuids.get(i)));
        }

        if (dataVersions.get(i) != null) {
            fs.mkdirs(new Path(accumuloPath + "/" + ServerConstants.VERSION_DIR));
            fs.createNewFile(
                    new Path(accumuloPath + "/" + ServerConstants.VERSION_DIR + "/" + dataVersions.get(i)));
        }
    }

    return accumuloPaths;
}

From source file:org.apache.hama.graph.DiskVerticesInfo.java

License:Apache License

@Override
public void init(GraphJobRunner<V, E, M> runner, HamaConfiguration conf, TaskAttemptID attempt)
        throws IOException {
    this.runner = runner;
    this.conf = conf;
    tmpSoftOffsets = new ArrayList<Long>();
    tmpStaticOffsets = new ArrayList<Long>();
    String p = conf.get(DISK_VERTICES_PATH_KEY, "/tmp/graph/");
    rootPath = p + attempt.getJobID().toString() + "/" + attempt.toString() + "/";
    LocalFileSystem local = FileSystem.getLocal(conf);
    local.mkdirs(new Path(rootPath));
    staticFile = rootPath + "static.graph";
    local.delete(new Path(staticFile), false);
    staticGraphPartsDos = local.create(new Path(staticFile));
    String softGraphFileName = getSoftGraphFileName(rootPath, currentStep);
    local.delete(new Path(softGraphFileName), false);
    softGraphPartsDos = local.create(new Path(softGraphFileName));
}