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

Method copyFromLocal

src/hdfs/hdfs.cpp:334–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332
333
334Future<Nothing> HDFS::copyFromLocal(const string& from, const string& to)
335{
336 if (!os::exists(from)) {
337 return Failure("Failed to find '" + from + "'");
338 }
339
340 Try<Subprocess> s = subprocess(
341 hadoop,
342 {"hadoop", "fs", "-copyFromLocal", from, normalize(to)},
343 Subprocess::PATH(os::DEV_NULL),
344 Subprocess::PIPE(),
345 Subprocess::PIPE());
346
347 if (s.isError()) {
348 return Failure("Failed to execute the subprocess: " + s.error());
349 }
350
351 return result(s.get())
352 .then([](const CommandResult& result) -> Future<Nothing> {
353 if (result.status.isNone()) {
354 return Failure("Failed to reap the subprocess");
355 }
356
357 if (result.status.get() != 0) {
358 return Failure(
359 "Unexpected result from the subprocess: "
360 "status='" + stringify(result.status.get()) + "', " +
361 "stdout='" + result.out + "', " +
362 "stderr='" + result.err + "'");
363 }
364
365 return Nothing();
366 });
367}
368
369
370Future<Nothing> HDFS::copyToLocal(const string& from, const string& to)

Callers 2

mainFunction · 0.80

Calls 12

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

Tested by 1