/** * Shortcut for {@code waitCompleted(fs, uri, -1, TimeUnit.MILLISECONDS)}, i.e., wait for an * indefinite amount of time. Note that if a file is never completed, the thread will block * forever, so use with care. * * @param fs a {@link FileSystem} instance * @param uri the URI of the file on which the thread should wait * @param waitCompletedPollMs milliseconds to wait between polling the filesystem * @return true if the file is complete when this method returns and false if the method timed out * before the file was complete. * @throws InterruptedException if the thread receives an interrupt while waiting for file * completion * @see #waitCompleted(FileSystem, AlluxioURI, long, TimeUnit, long) */ public static boolean waitCompleted(FileSystem fs, AlluxioURI uri, long waitCompletedPollMs) throws IOException, AlluxioException, InterruptedException { return FileSystemUtils.waitCompleted(fs, uri, -1, TimeUnit.MILLISECONDS, waitCompletedPollMs); }
@Override public Void call() throws Exception { AlluxioURI toPersist = mFilesToPersist.poll(); while (toPersist != null) { try { FileSystemUtils.persistFile(mFileSystem, mFsContext, toPersist); synchronized (mProgressLock) { // Prevents out of order progress tracking. String progress = "(" + mCompletedFiles.incrementAndGet() + "/" + mTotalFiles + ")"; System.out.println(progress + " Successfully persisted file: " + toPersist); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw e; } catch (Exception e) { System.out.println("Failed to persist file " + toPersist); LOG.error("Failed to persist file {}", toPersist, e); } toPersist = mFilesToPersist.poll(); } return null; } }
AlluxioException, IOException { List<AlluxioURI> inconsistentUris = FileSystemUtils.checkConsistency(mFsContext, path, CheckConsistencyPOptions.getDefaultInstance()); if (inconsistentUris.isEmpty()) {
/** * Shortcut for {@code waitCompleted(fs, uri, -1, TimeUnit.MILLISECONDS)}, i.e., wait for an * indefinite amount of time. Note that if a file is never completed, the thread will block * forever, so use with care. * * @param fs a {@link FileSystem} instance * @param uri the URI of the file on which the thread should wait * @return true if the file is complete when this method returns and false if the method timed out * before the file was complete. * @throws IOException in case there are problems contacting the Alluxio master for the file * status * @throws AlluxioException if an Alluxio Exception occurs * @throws InterruptedException if the thread receives an interrupt while waiting for file * completion * @see #waitCompleted(FileSystem, AlluxioURI, long, TimeUnit) */ public static boolean waitCompleted(FileSystem fs, AlluxioURI uri) throws IOException, AlluxioException, InterruptedException { return FileSystemUtils.waitCompleted(fs, uri, -1, TimeUnit.MILLISECONDS); }