本文整理了Java中org.apache.hadoop.tools.DistCp.execute()
方法的一些代码示例,展示了DistCp.execute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DistCp.execute()
方法的具体详情如下:
包路径:org.apache.hadoop.tools.DistCp
类名称:DistCp
方法名:execute
[英]Implements the core-execution. Creates the file-list for copy, and launches the Hadoop-job, to do the copy.
[中]实现核心执行。创建用于复制的文件列表,并启动Hadoop作业来执行复制。
代码示例来源:origin: apache/hbase
job = super.execute();
代码示例来源:origin: com.hotels/circus-train-distcp-copier
@Override
public Job exec(Configuration conf, DistCpOptions options) throws Exception {
return new DistCp(conf, options).execute();
}
};
代码示例来源:origin: HotelsDotCom/circus-train
@Override
public Job exec(Configuration conf, DistCpOptions options) throws Exception {
return new DistCp(conf, options).execute();
}
};
代码示例来源:origin: org.springframework.data/spring-data-hadoop-core
private static void invokeCopy(Configuration config, String[] parsedArgs) {
try {
log.info("Running DistCp with arguments [" + StringUtils.arrayToCommaDelimitedString(parsedArgs) + "]");
DistCpOptions inputOptions = OptionsParser.parse(parsedArgs);
org.apache.hadoop.tools.DistCp distCp = new org.apache.hadoop.tools.DistCp(config, inputOptions);
distCp.execute();
} catch (Exception e) {
throw new HadoopException("Error running DistCp job", e);
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-distcp
execute();
} catch (InvalidInputException e) {
LOG.error("Invalid input: ", e);
代码示例来源:origin: org.apache.hadoop/hadoop-distcp
execute();
} catch (InvalidInputException e) {
LOG.error("Invalid input: ", e);
代码示例来源:origin: NationalSecurityAgency/datawave
log.info("Starting distcp from " + srcPath + " to " + destPath + " with configuration: " + options);
try {
cp.execute();
} catch (Exception e) {
throw new RuntimeException("Distcp failed.", e);
代码示例来源:origin: apache/crunch
if (!distCp.execute().isSuccessful()) {
throw new CrunchRuntimeException("Unable to move files through distcp from " + src + " to " + path);
代码示例来源:origin: io.hops/hadoop-distcp
private void runTest(Path listFile, Path target, boolean targetExists,
boolean sync) throws IOException {
DistCpOptions options = new DistCpOptions(listFile, target);
options.setSyncFolder(sync);
options.setTargetPathExists(targetExists);
try {
new DistCp(getConf(), options).execute();
} catch (Exception e) {
LOG.error("Exception encountered ", e);
throw new IOException(e);
}
}
代码示例来源:origin: io.hops/hadoop-distcp
@Test(timeout=100000)
public void testCleanup() {
try {
Path sourcePath = new Path("noscheme:///file");
List<Path> sources = new ArrayList<Path>();
sources.add(sourcePath);
DistCpOptions options = new DistCpOptions(sources, target);
Configuration conf = getConf();
Path stagingDir = JobSubmissionFiles.getStagingDir(
new Cluster(conf), conf);
stagingDir.getFileSystem(conf).mkdirs(stagingDir);
try {
new DistCp(conf, options).execute();
} catch (Throwable t) {
Assert.assertEquals(stagingDir.getFileSystem(conf).
listStatus(stagingDir).length, 0);
}
} catch (Exception e) {
LOG.error("Exception encountered ", e);
Assert.fail("testCleanup failed " + e.getMessage());
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-distcp
@Test(timeout=100000)
public void testCleanup() {
try {
Path sourcePath = new Path("noscheme:///file");
List<Path> sources = new ArrayList<Path>();
sources.add(sourcePath);
DistCpOptions options = new DistCpOptions.Builder(sources, target)
.build();
Configuration conf = getConf();
Path stagingDir = JobSubmissionFiles.getStagingDir(
new Cluster(conf), conf);
stagingDir.getFileSystem(conf).mkdirs(stagingDir);
try {
new DistCp(conf, options).execute();
} catch (Throwable t) {
Assert.assertEquals(stagingDir.getFileSystem(conf).
listStatus(stagingDir).length, 0);
}
} catch (Exception e) {
LOG.error("Exception encountered ", e);
Assert.fail("testCleanup failed " + e.getMessage());
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-distcp
private void runTest(Path listFile, Path target, boolean targetExists,
boolean sync) throws IOException {
final DistCpOptions options = new DistCpOptions.Builder(listFile, target)
.withSyncFolder(sync)
.build();
try {
final DistCp distcp = new DistCp(getConf(), options);
distcp.context.setTargetPathExists(targetExists);
distcp.execute();
} catch (Exception e) {
LOG.error("Exception encountered ", e);
throw new IOException(e);
}
}
代码示例来源:origin: io.hops/hadoop-distcp
private void runTest(Path listFile, Path target, boolean targetExists,
boolean sync, boolean delete,
boolean overwrite) throws IOException {
DistCpOptions options = new DistCpOptions(listFile, target);
options.setSyncFolder(sync);
options.setDeleteMissing(delete);
options.setOverwrite(overwrite);
options.setTargetPathExists(targetExists);
options.setNumListstatusThreads(numListstatusThreads);
try {
new DistCp(getConf(), options).execute();
} catch (Exception e) {
LOG.error("Exception encountered ", e);
throw new IOException(e);
}
}
代码示例来源:origin: io.hops/hadoop-distcp
/**
* Executes DistCp and asserts that the job finished successfully.
*
* @param src source path
* @param dst destination path
* @throws Exception if there is a failure
*/
private void runDistCp(Path src, Path dst) throws Exception {
DistCpOptions options = new DistCpOptions(Arrays.asList(src), dst);
Job job = new DistCp(conf, options).execute();
assertNotNull("Unexpected null job returned from DistCp execution.", job);
assertTrue("DistCp job did not complete.", job.isComplete());
assertTrue("DistCp job did not complete successfully.", job.isSuccessful());
}
代码示例来源:origin: org.apache.hadoop/hadoop-distcp
private void runTest(Path listFile, Path target, boolean targetExists,
boolean sync, boolean delete,
boolean overwrite) throws IOException {
final DistCpOptions options = new DistCpOptions.Builder(listFile, target)
.withSyncFolder(sync)
.withDeleteMissing(delete)
.withOverwrite(overwrite)
.withNumListstatusThreads(numListstatusThreads)
.build();
try {
final DistCp distCp = new DistCp(getConf(), options);
distCp.context.setTargetPathExists(targetExists);
distCp.execute();
} catch (Exception e) {
LOG.error("Exception encountered ", e);
throw new IOException(e);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-distcp
/**
* Run the distcp job.
* @param optons distcp options
* @return the job. It will have already completed.
* @throws Exception failure
*/
private Job runDistCp(final DistCpOptions options) throws Exception {
Job job = new DistCp(conf, options).execute();
assertNotNull("Unexpected null job returned from DistCp execution.", job);
assertTrue("DistCp job did not complete.", job.isComplete());
assertTrue("DistCp job did not complete successfully.", job.isSuccessful());
return job;
}
代码示例来源:origin: org.apache.hadoop/hadoop-distcp
/**
* Test a case where the source path is relative.
*/
@Test
public void testSync9() throws Exception {
// use /user/$USER/source for source directory
Path sourcePath = new Path(dfs.getWorkingDirectory(), "source");
initData9(sourcePath);
initData9(target);
dfs.allowSnapshot(sourcePath);
dfs.allowSnapshot(target);
dfs.createSnapshot(sourcePath, "s1");
dfs.createSnapshot(target, "s1");
changeData9(sourcePath);
dfs.createSnapshot(sourcePath, "s2");
String[] args = new String[]{"-update","-diff", "s1", "s2",
"source", target.toString()};
new DistCp(conf, OptionsParser.parse(args)).execute();
verifyCopy(dfs.getFileStatus(sourcePath),
dfs.getFileStatus(target), false);
}
内容来源于网络,如有侵权,请联系作者删除!