Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FileSystem.rename()


      Path finalIndexFile = mapOutputFile.getOutputIndexFileForWrite(
                            getTaskId(), finalIndexFileSize);
     
      if (numSpills == 1) { //the spill is the final output
        localFs.rename(filename[0], finalOutputFile);
        localFs.rename(indexFileName[0], finalIndexFile);
        return;
      }
     
      //The output stream for the final single output file
      FSDataOutputStream finalOut = localFs.create(finalOutputFile, true,
View Full Code Here


    try {
      FileSystem fs = TraceFileSystem.wrap(org.apache.accumulo.core.file.FileUtil.getFileSystem(CachedConfiguration.getInstance(),
          ServerConfiguration.getSiteConfiguration()));
     
      FileUtil.copy(fs, orig, fs, tmp, false, true, CachedConfiguration.getInstance());
      fs.rename(tmp, dest);
      log.debug("copied " + orig + " to " + dest);
    } catch (IOException ex) {
      try {
        FileSystem fs = TraceFileSystem.wrap(org.apache.accumulo.core.file.FileUtil.getFileSystem(CachedConfiguration.getInstance(),
            ServerConfiguration.getSiteConfiguration()));
View Full Code Here

     
      for (FileStatus fileStatus : files) {
        String newName = fileNameMappings.get(fileStatus.getPath().getName());
       
        if (newName != null)
          fs.rename(fileStatus.getPath(), new Path(tableInfo.importDir, newName));
      }
     
      return new FinishImportTable(tableInfo);
    } catch (IOException ioe) {
      log.warn(ioe.getMessage(), ioe);
View Full Code Here

   
    // move failed files that were not loaded
    for (String failure : failures.values()) {
      Path orig = new Path(failure);
      Path dest = new Path(error, orig.getName());
      fs.rename(orig, dest);
      log.debug("tid " + tid + " renamed " + orig + " to " + dest + ": import failed");
    }
   
    if (loadedFailures.size() > 0) {
      DistributedWorkQueue bifCopyQueue = new DistributedWorkQueue(Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID()
View Full Code Here

    private void moveMatrices() throws IOException {
        //so it can output to Solr if options specify
        FileSystem fs = FileSystem.get(getConf());
        Path from = new Path(options.getPrimarySimilarityMatrixPath());
        Path to = new Path(options.getPrimaryOutputDir(), XRecommenderJob.SIMS_MATRIX_DIR);//steal the dir name from Xrec
        fs.rename(from, to);
        //move the primary user action matrix to output
        from = new Path(new Path(options.getPrimaryTempDir(), RecommenderJob.DEFAULT_PREPARE_PATH), PreparePreferenceMatrixJob.USER_VECTORS);
        to = new Path(options.getOutputDir(), options.getPrimaryActionHistoryDir());
        fs.rename(from, to);
        //if it was created move the secondary user action matrix to output
View Full Code Here

        Path to = new Path(options.getPrimaryOutputDir(), XRecommenderJob.SIMS_MATRIX_DIR);//steal the dir name from Xrec
        fs.rename(from, to);
        //move the primary user action matrix to output
        from = new Path(new Path(options.getPrimaryTempDir(), RecommenderJob.DEFAULT_PREPARE_PATH), PreparePreferenceMatrixJob.USER_VECTORS);
        to = new Path(options.getOutputDir(), options.getPrimaryActionHistoryDir());
        fs.rename(from, to);
        //if it was created move the secondary user action matrix to output
        if(options.getDoXRecommender()){
            from = new Path(new Path(options.getSecondaryTempDir(), XRecommenderJob.DEFAULT_PREPARE_DIR), PrepareActionMatricesJob.USER_VECTORS_A);
            to = new Path(options.getOutputDir(), options.getSecondaryActionHistoryDir());
            fs.rename(from, to);
View Full Code Here

        fs.rename(from, to);
        //if it was created move the secondary user action matrix to output
        if(options.getDoXRecommender()){
            from = new Path(new Path(options.getSecondaryTempDir(), XRecommenderJob.DEFAULT_PREPARE_DIR), PrepareActionMatricesJob.USER_VECTORS_A);
            to = new Path(options.getOutputDir(), options.getSecondaryActionHistoryDir());
            fs.rename(from, to);
        }
    }


    public static void main(String[] args) throws Exception {
View Full Code Here

        // move [B'A] to the final output location
        // if the dest path is not created the rename will fail on HDFS (without an exception?)
        // but will create the full path
        // on the local FS ??????????? Won't hurt to create on local so doing that now.
        if(!fs.exists(outputPath)) fs.mkdirs(outputPath);
        fs.rename(cooccurrenceMatrixPath, new Path(similarItemsPath.toString()));
        // now move the recommendations matrix to the output path
        Path outputRecsPath = new Path(getOption("output"), RECS_MATRIX_DIR);
        fs.rename(recsMatrixPath, outputRecsPath);

        return 0;
View Full Code Here

        // on the local FS ??????????? Won't hurt to create on local so doing that now.
        if(!fs.exists(outputPath)) fs.mkdirs(outputPath);
        fs.rename(cooccurrenceMatrixPath, new Path(similarItemsPath.toString()));
        // now move the recommendations matrix to the output path
        Path outputRecsPath = new Path(getOption("output"), RECS_MATRIX_DIR);
        fs.rename(recsMatrixPath, outputRecsPath);

        return 0;
    }

    private Path findMostRecentPath(Path where, String what) throws IOException {
View Full Code Here

        fs.mkdirs(dst.getParent());
        LOG.info("Trying to sildeline reference file "
          + path + " to " + dst);
        setShouldRerun();

        success = fs.rename(path, dst);
      }
      if (!success) {
        LOG.error("Failed to sideline reference file " + path);
      }
    }
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.