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

Function downloadWithHadoopClient

src/launcher/fetcher.cpp:140–161  ·  view source on GitHub ↗

Attempt to get the uri using the hadoop client.

Source from the content-addressed store, hash-verified

138
139// Attempt to get the uri using the hadoop client.
140static Try<string> downloadWithHadoopClient(
141 const string& sourceUri,
142 const string& destinationPath)
143{
144 Try<Owned<HDFS>> hdfs = HDFS::create();
145 if (hdfs.isError()) {
146 return Error("Failed to create HDFS client: " + hdfs.error());
147 }
148
149 LOG(INFO) << "Downloading resource with Hadoop client from '" << sourceUri
150 << "' to '" << destinationPath << "'";
151
152 Future<Nothing> result = hdfs.get()->copyToLocal(sourceUri, destinationPath);
153 result.await();
154
155 if (!result.isReady()) {
156 return Error("HDFS copyToLocal failed: " +
157 (result.isFailed() ? result.failure() : "discarded"));
158 }
159
160 return destinationPath;
161}
162
163
164static Try<string> downloadWithNet(

Callers 1

downloadFunction · 0.85

Calls 10

copyToLocalMethod · 0.80
isReadyMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
errorMethod · 0.65
createFunction · 0.50
ErrorFunction · 0.50
isErrorMethod · 0.45
getMethod · 0.45
awaitMethod · 0.45

Tested by

no test coverage detected