Java Code Examples for org.apache.hadoop.tools.DistCpOptions#setBlocking()
The following examples show how to use
org.apache.hadoop.tools.DistCpOptions#setBlocking() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DistCpCopier.java From circus-train with Apache License 2.0 | 5 votes |
@Override public Metrics copy() throws CircusTrainException { LOG.info("Copying table data."); LOG.debug("Invoking DistCp: {} -> {}", sourceDataBaseLocation, replicaDataLocation); DistCpOptions distCpOptions = parseCopierOptions(copierOptions); LOG.debug("Invoking DistCp with options: {}", distCpOptions); CircusTrainCopyListing.setAsCopyListingClass(conf); CircusTrainCopyListing.setRootPath(conf, sourceDataBaseLocation); try { distCpOptions.setBlocking(false); Job job = executor.exec(conf, distCpOptions); String counter = String .format("%s_BYTES_WRITTEN", replicaDataLocation.toUri().getScheme().toUpperCase(Locale.ROOT)); registerRunningJobMetrics(job, counter); if (!job.waitForCompletion(true)) { throw new IOException( "DistCp failure: Job " + job.getJobID() + " has failed: " + job.getStatus().getFailureInfo()); } return new JobMetrics(job, FileSystemCounter.class.getName(), counter); } catch (Exception e) { cleanUpReplicaDataLocation(); throw new CircusTrainException("Unable to copy file(s)", e); } }
Example 2
Source File: CubeMigrationCrossClusterCLI.java From kylin with Apache License 2.0 | 5 votes |
protected void copyHDFSPath(String srcDir, Configuration srcConf, String dstDir, Configuration dstConf) throws Exception { logger.info("start to copy hdfs directory from {} to {}", srcDir, dstDir); DistCpOptions distCpOptions = OptionsParser.parse(new String[] { srcDir, dstDir }); distCpOptions.preserve(DistCpOptions.FileAttribute.BLOCKSIZE); distCpOptions.setBlocking(true); setTargetPathExists(distCpOptions); DistCp distCp = new DistCp(getConfOfDistCp(), distCpOptions); distCp.execute(); logger.info("copied hdfs directory from {} to {}", srcDir, dstDir); }