List of usage examples for org.apache.hadoop.fs LocalFileSystem delete
@Override public boolean delete(Path f, boolean recursive) throws IOException
From source file:backup.namenode.NameNodeBackupBlockCheckProcessor.java
License:Apache License
private Path getLocalSort(String name) throws IOException { Path sortDir = conf.getLocalPath(DFS_BACKUP_NAMENODE_LOCAL_DIR_KEY, name); LocalFileSystem local = FileSystem.getLocal(conf); sortDir = sortDir.makeQualified(local.getUri(), local.getWorkingDirectory()); local.delete(sortDir, true); return sortDir; }
From source file:org.apache.hama.bsp.BSPPeerImpl.java
License:Apache License
/** * Delete files from the local cache// w ww. ja va 2 s . c o m * * @throws IOException If a DistributedCache file cannot be found. */ public void deleteLocalFiles() throws IOException { if (DistributedCache.getLocalCacheFiles(conf) != null) { for (Path path : DistributedCache.getLocalCacheFiles(conf)) { if (path != null) { LocalFileSystem local = FileSystem.getLocal(conf); if (local.exists(path)) { local.delete(path, true); // recursive true } } } } // I've replaced the use of the missing setLocalFiles and // addLocalFiles methods (hadoop 0.23.x) with our own DistCacheUtils methods // which set the cache configurations directly. DistCacheUtils.setLocalFiles(conf, ""); }
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)); }
From source file:org.apache.hama.graph.DiskVerticesInfo.java
License:Apache License
@Override public void startSuperstep() throws IOException { index = 0;/*ww w . jav a 2 s . c o m*/ 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]; }
From source file:org.apache.hama.graph.DiskVerticesInfo.java
License:Apache License
@Override public void finishSuperstep() throws IOException { // do not delete files in the first step IOUtils.cleanup(null, softGraphPartsDos, softGraphPartsNextIterationDos, softGraphPartsDis); if (currentStep > 0) { LocalFileSystem local = FileSystem.getLocal(conf); local.delete(new Path(getSoftGraphFileName(rootPath, currentStep - 1)), true); String softGraphFileName = getSoftGraphFileName(rootPath, currentStep); softGraphPartsDis = local.open(new Path(softGraphFileName)); }/*from w ww. j a v a 2s .co m*/ currentStep++; }
From source file:org.apache.tajo.TajoTestingCluster.java
License:Apache License
public void shutdownMiniCluster() throws IOException { LOG.info("========================================"); LOG.info("Minicluster is stopping"); LOG.info("========================================"); try {/* w ww .j a v a2s . c om*/ Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } shutdownMiniTajoCluster(); if (this.catalogServer != null) { shutdownCatalogCluster(); isCatalogServerRunning = false; } try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } if (this.dfsCluster != null) { try { FileSystem fs = this.dfsCluster.getFileSystem(); if (fs != null) fs.close(); this.dfsCluster.shutdown(); } catch (IOException e) { System.err.println("error closing file system: " + e); } isDFSRunning = false; } if (this.clusterTestBuildDir != null && this.clusterTestBuildDir.exists()) { if (!ShutdownHookManager.get().isShutdownInProgress()) { //TODO clean test dir when ShutdownInProgress LocalFileSystem localFS = LocalFileSystem.getLocal(conf); localFS.delete(new Path(clusterTestBuildDir.toString()), true); localFS.close(); } this.clusterTestBuildDir = null; } if (hbaseUtil != null) { hbaseUtil.stopZooKeeperCluster(); hbaseUtil.stopHBaseCluster(); } LOG.info("Minicluster is down"); isTajoClusterRunning = false; }
From source file:org.elasticsearch.repositories.hdfs.HdfsSnapshotRestoreTest.java
License:Apache License
/** * Deletes content of the repository files in the bucket *///ww w . ja v a 2s. co m public void cleanRepositoryFiles(String basePath) throws IOException { LocalFileSystem fs = FileSystem.getLocal(new Configuration()); Path p = new Path(path); fs.delete(p.makeQualified(fs), true); }
From source file:tajo.TajoTestingUtility.java
License:Apache License
public void shutdownMiniCluster() throws IOException { LOG.info("Shutting down minicluster"); shutdownMiniTajoCluster();/*from w w w . ja v a 2s . c o m*/ if (!this.passedZkCluster) shutdownMiniZKCluster(); if (this.dfsCluster != null) { this.dfsCluster.shutdown(); } if (this.clusterTestBuildDir != null && this.clusterTestBuildDir.exists()) { LocalFileSystem localFS = LocalFileSystem.getLocal(conf); localFS.delete(new Path(clusterTestBuildDir.toString()), true); this.clusterTestBuildDir = null; } if (this.catalogCluster != null) { shutdownCatalogCluster(); } LOG.info("Minicluster is down"); }