MCPcopy Create free account
hub / github.com/apache/mesos / copyToLocal

Method copyToLocal

src/hdfs/hdfs.cpp:370–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368
369
370Future<Nothing> HDFS::copyToLocal(const string& from, const string& to)
371{
372 Try<Subprocess> s = subprocess(
373 hadoop,
374 {hadoop, "fs", "-copyToLocal", normalize(from), to},
375 Subprocess::PATH(os::DEV_NULL),
376 Subprocess::PIPE(),
377 Subprocess::PIPE());
378
379 if (s.isError()) {
380 return Failure("Failed to execute the subprocess: " + s.error());
381 }
382
383 return result(s.get())
384 .then([](const CommandResult& result) -> Future<Nothing> {
385 if (result.status.isNone()) {
386 return Failure("Failed to reap the subprocess");
387 }
388
389 if (result.status.get() != 0) {
390 return Failure(
391 "Unexpected result from the subprocess: "
392 "status='" + stringify(result.status.get()) + "', " +
393 "stdout='" + result.out + "', " +
394 "stderr='" + result.err + "'");
395 }
396
397 return Nothing();
398 });
399}

Callers 3

fetchMethod · 0.80
downloadWithHadoopClientFunction · 0.80

Calls 11

FailureClass · 0.85
resultFunction · 0.85
NothingClass · 0.85
normalizeFunction · 0.70
errorMethod · 0.65
subprocessFunction · 0.50
stringifyFunction · 0.50
isErrorMethod · 0.45
thenMethod · 0.45
getMethod · 0.45
isNoneMethod · 0.45

Tested by 1