[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
|  
Report Content as Inappropriate

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

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

    https://github.com/apache/incubator-flink/pull/3#discussion_r13638364
 
    --- 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 --
   
    good catch, its a relic from when this method wasn't synchronized. will fix that.


---
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.
---
Loading...