Attempt to get the uri using the hadoop client.
| 138 | |
| 139 | // Attempt to get the uri using the hadoop client. |
| 140 | static 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 | |
| 164 | static Try<string> downloadWithNet( |