/** * Returns all jars that are in the directory. It is useful in expanding a * wildcard path to return all jars from the directory to use in a classpath. * * @param path the path to the directory. The path may include the wildcard. * @return the list of jars as URLs, or an empty list if there are no jars, or * the directory does not exist */ public static List<Path> getJarsInDirectory(String path, boolean useLocal) { List<Path> paths = new ArrayList<>(); try { // add the wildcard if it is not provided if (!path.endsWith("*")) { path += File.separator + "*"; } Path globPath = new Path(path).suffix("{.jar,.JAR}"); FileContext context = useLocal ? FileContext.getLocalFSFileContext() : FileContext.getFileContext(globPath.toUri()); FileStatus[] files = context.util().globStatus(globPath); if (files != null) { for (FileStatus file: files) { paths.add(file.getPath()); } } } catch (IOException ignore) {} // return the empty list return paths; }
File targetWorkDir = new File("target", clusterNameTrimmed); try { FileContext.getLocalFSFileContext().delete( new Path(targetWorkDir.getAbsolutePath()), true); } catch (Exception e) {
@Override public void close() throws IOException { yarnCluster.close(); FileContext.getLocalFSFileContext().delete(new Path(workDir.getAbsolutePath()), true); }
private static FileContext getLfs() { try { return FileContext.getLocalFSFileContext(); } catch (UnsupportedFileSystemException e) { throw new RuntimeException(e); } }
/** * Default constructor for use in testing. */ @VisibleForTesting public DefaultContainerExecutor() { try { this.lfs = FileContext.getLocalFSFileContext(); } catch (UnsupportedFileSystemException e) { throw new RuntimeException(e); } }
public TezLocalCacheManager(Map<String, LocalResource> resources, Configuration conf) throws IOException { this.ugi = UserGroupInformation.getCurrentUser(); this.fileContext = FileContext.getLocalFSFileContext(); this.resources = resources; this.conf = conf; this.tempDir = Files.createTempDirectory(Paths.get("."), "tez-local-cache"); }
FileContext getLocalFileContext(Configuration conf) { try { return FileContext.getLocalFSFileContext(conf); } catch (IOException e) { throw new YarnRuntimeException("Failed to access local fs"); } }
FileContext getLocalFileContext(Configuration conf) { try { return FileContext.getLocalFSFileContext(conf); } catch (IOException e) { throw new YarnRuntimeException("Failed to access local fs"); } }
FileContext getLocalFileContext(Configuration conf) { try { return FileContext.getLocalFSFileContext(conf); } catch (IOException e) { throw new YarnRuntimeException("Failed to access local fs"); } }
@Before public void setUp() throws Exception { fc = FileContext.getLocalFSFileContext(); super.setUp(); }
private String setupTestWorkDir() { File testWorkDir = new File("target", this.getClass().getCanonicalName()); try { FileContext.getLocalFSFileContext().delete( new Path(testWorkDir.getAbsolutePath()), true); return testWorkDir.getAbsolutePath(); } catch (Exception e) { LOG.warn("Could not cleanup", e); throw new YarnRuntimeException("could not cleanup test dir", e); } }
@BeforeClass public static void setup() throws AccessControlException, FileNotFoundException, UnsupportedFileSystemException, IOException { localFS = FileContext.getLocalFSFileContext(); localFS.delete(new Path(localFSDirBase.getAbsolutePath()), true); localFSDirBase.mkdirs(); // Do not start cluster here }
@BeforeClass public static void setup() throws AccessControlException, FileNotFoundException, IllegalArgumentException, IOException { //Do not error out if metrics are inited multiple times DefaultMetricsSystem.setMiniClusterMode(true); File dir = new File(stagingDir); stagingDir = dir.getAbsolutePath(); localFS = FileContext.getLocalFSFileContext(); localFS.delete(testDir, true); new File(testDir.toString()).mkdir(); }
@Override @Before public void setUp() throws Exception { // create the test root on local_fs fcTarget = FileContext.getLocalFSFileContext(); super.setUp(); }
@Before public void setup() throws IOException { assumeTrue(Shell.LINUX); FileContext.getLocalFSFileContext().delete( new Path(TEST_ROOT_DIR.getAbsolutePath()), true); }
@Before public void setup() throws IOException { assumeTrue(Shell.LINUX); FileContext.getLocalFSFileContext().delete( new Path(TEST_ROOT_DIR.getAbsolutePath()), true); }
@Before public void setup() throws IOException { assumeTrue(Shell.LINUX); FileContext.getLocalFSFileContext().delete( new Path(TEST_ROOT_DIR.getAbsolutePath()), true); }
@Override @Before public void setUp() throws Exception { fc = FileContext.getLocalFSFileContext(); super.setUp(); }
@Override @Before public void setUp() throws Exception { fc = FileContext.getLocalFSFileContext(); super.setUp(); } }
@Before public void setUp() throws Exception { fc = FileContext.getLocalFSFileContext(); fc.mkdir(fileContextTestHelper.getTestRootPath(fc, "test"), FileContext.DEFAULT_PERM, true); }