[GitHub] incubator-flink pull request: DistCache: executable flag, dir supp...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-flink pull request: DistCache: executable flag, dir supp...

zentol
Github user rmetzger commented on a diff in the pull request:

    https://github.com/apache/incubator-flink/pull/3#discussion_r13617314
 
    --- Diff: stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/cache/FileCache.java ---
    @@ -93,6 +104,35 @@ public void shutdown() {
      }
      }
     
    + public static void copy(Path sourcePath, Path targetPath, boolean executable) throws IOException {
    + FileSystem sFS = sourcePath.getFileSystem();
    + FileSystem tFS = targetPath.getFileSystem();
    + if (!tFS.exists(targetPath)) {
    + if (sFS.getFileStatus(sourcePath).isDir()) {
    + tFS.mkdirs(targetPath);
    + FileStatus[] contents = sFS.listStatus(sourcePath);
    + for (FileStatus content : contents) {
    + String distPath = content.getPath().toString();
    + if (content.isDir()) {
    + if (distPath.endsWith("/")) {
    + distPath = distPath.substring(0, distPath.length() - 1);
    + }
    + }
    + String localPath = targetPath.toString() + distPath.substring(distPath.lastIndexOf("/"));
    + copy(content.getPath(), new Path(localPath), executable);
    + }
    + } else {
    + try {
    + FSDataOutputStream lfsOutput = tFS.create(targetPath, false);
    + FSDataInputStream fsInput = sFS.open(sourcePath);
    + IOUtils.copyBytes(fsInput, lfsOutput);
    + new File(targetPath.toString()).setExecutable(executable);
    + } catch (IOException ioe) {
    --- End diff --
   
    Can you add a comment here? Why are you swallowing the exceptions here? It is very likely that an exception is thrown here, and the user should know.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---