Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.LocalFileSystem.create()


     */
    @Test
    public void input_empty() throws Exception {
        LocalFileSystem fs = FileSystem.getLocal(conf);
        Path path = new Path(folder.newFile("testing").toURI());
        fs.create(path).close();
        ModelInput<StringOption> in = format.createInput(
                StringOption.class,
                fs,
                path,
                0,
View Full Code Here


     */
    @Test(expected = IOException.class)
    public void input_invalid() throws Exception {
        LocalFileSystem fs = FileSystem.getLocal(conf);
        Path path = new Path(folder.newFile("testing").toURI());
        FSDataOutputStream output = fs.create(path);
        try {
            output.writeUTF("Hello, world!");
        } finally {
            output.close();
        }
View Full Code Here

    Configuration conf = new Configuration();
    LocalFileSystem fs = FileSystem.getLocal(conf);
    // create an empty file (which is not a valid rcfile)
    Path path = new Path(System.getProperty("test.build.data", ".")
        + "/broken.rcfile");
    fs.create(path).close();
    // try to create RCFile.Reader
    final TestFSDataInputStream[] openedFile = new TestFSDataInputStream[1];
    try {
      new RCFile.Reader(fs, path, conf) {
        // this method is called by the RCFile.Reader constructor, overwritten,
View Full Code Here

    Configuration conf = new Configuration();
    LocalFileSystem fs = FileSystem.getLocal(conf);
    // create an empty file (which is not a valid rcfile)
    Path path = new Path(System.getProperty("test.build.data", ".")
        + "/broken.rcfile");
    fs.create(path).close();
    // try to create RCFile.Reader
    final TestFSDataInputStream[] openedFile = new TestFSDataInputStream[1];
    try {
      new RCFile.Reader(fs, path, conf) {
        // this method is called by the RCFile.Reader constructor, overwritten,
View Full Code Here

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

    String myResourcePath = System.getProperty("test.build.data");
    Path schedulerConfigFilePath =
        new Path(myResourcePath, CapacitySchedulerConf.SCHEDULER_CONF_FILE);
    OutputStream out = fs.create(schedulerConfigFilePath);

    Configuration config = new Configuration(false);
    for (Enumeration<?> e = schedulerConfProps.propertyNames(); e
        .hasMoreElements();) {
      String key = (String) e.nextElement();
View Full Code Here

    Configuration conf = new Configuration();
    LocalFileSystem fs = FileSystem.getLocal(conf);
    // create an empty file (which is not a valid rcfile)
    Path path = new Path(System.getProperty("test.build.data", "target")
        + "/broken.rcfile");
    fs.create(path).close();
    // try to create RCFile.Reader
    final TestFSDataInputStream[] openedFile = new TestFSDataInputStream[1];
    try {
      new RCFile.Reader(fs, path, conf) {
        // this method is called by the RCFile.Reader constructor, overwritten,
View Full Code Here

        + "/";
    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));
  }
View Full Code Here

    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));
  }

  @Override
  public void cleanup(HamaConfiguration conf, TaskAttemptID attempt)
      throws IOException {
View Full Code Here

  public void startSuperstep() throws IOException {
    index = 0;
    String softGraphFileName = getSoftGraphFileName(rootPath, currentStep);
    LocalFileSystem local = FileSystem.getLocal(conf);
    local.delete(new Path(softGraphFileName), true);
    softGraphPartsNextIterationDos = local.create(new Path(softGraphFileName));
    softValueOffsets = softValueOffsetsNextIteration;
    softValueOffsetsNextIteration = new long[softValueOffsetsNextIteration.length];
  }

  @Override
View Full Code Here

   
    //write the serialized task information to a file to pass to the truncater
    Path taskRanFilePath =
      ldirAlloc.getLocalPathForWrite(taskRanFile, conf);
    LocalFileSystem lfs = FileSystem.getLocal(conf);
    FSDataOutputStream out = lfs.create(taskRanFilePath);
    out.writeInt(allAttempts.size());
    for (Task t : allAttempts) {
      out.writeBoolean(t.isMapTask());
      t.write(out);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.