-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BEAM-59] Beam FileSystems: add match(), copy(), rename(), delete() utilities. #2175
Conversation
Refer to this link for build results (access rights to CI server needed): |
5508baa
to
5950663
Compare
Refer to this link for build results (access rights to CI server needed): |
5950663
to
8e53b4b
Compare
Refer to this link for build results (access rights to CI server needed): |
8e53b4b
to
0bc6057
Compare
R: @dhalperi |
Refer to this link for build results (access rights to CI server needed): Build result: FAILURE[...truncated 553.79 KB...] at java.lang.Thread.run(Thread.java:745)Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Java_MavenInstall@2/runners/core-java/src/test/java/org/apache/beam/runners/core/ReduceFnTester.java:[364,25] no suitable method found for add(W) method java.util.Collection.add(org.apache.beam.runners.core.StateNamespace) is not applicable (argument mismatch; W cannot be converted to org.apache.beam.runners.core.StateNamespace) method java.util.Set.add(org.apache.beam.runners.core.StateNamespace) is not applicable (argument mismatch; W cannot be converted to org.apache.beam.runners.core.StateNamespace) at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1029) at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:170) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 31 more2017-03-14T09:47:07.477 [ERROR] 2017-03-14T09:47:07.477 [ERROR] Re-run Maven using the -X switch to enable full debug logging.2017-03-14T09:47:07.477 [ERROR] 2017-03-14T09:47:07.477 [ERROR] For more information about the errors and possible solutions, please read the following articles:2017-03-14T09:47:07.477 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException2017-03-14T09:47:07.478 [ERROR] 2017-03-14T09:47:07.478 [ERROR] After correcting the problems, you can resume the build with the command2017-03-14T09:47:07.478 [ERROR] mvn -rf :beam-runners-core-javachannel stoppedSetting status of f40cd72 to FAILURE with url https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/8379/ and message: 'Build finished. 'Using context: Jenkins: Maven clean install--none-- |
f4c437e
to
bac345c
Compare
Refer to this link for build results (access rights to CI server needed): Build result: FAILURE[...truncated 557.75 KB...] at java.lang.Thread.run(Thread.java:745)Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Java_MavenInstall/runners/core-java/src/test/java/org/apache/beam/runners/core/ReduceFnTester.java:[364,25] no suitable method found for add(W) method java.util.Collection.add(org.apache.beam.runners.core.StateNamespace) is not applicable (argument mismatch; W cannot be converted to org.apache.beam.runners.core.StateNamespace) method java.util.Set.add(org.apache.beam.runners.core.StateNamespace) is not applicable (argument mismatch; W cannot be converted to org.apache.beam.runners.core.StateNamespace) at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1029) at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:170) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 31 more2017-03-17T02:49:16.927 [ERROR] 2017-03-17T02:49:16.927 [ERROR] Re-run Maven using the -X switch to enable full debug logging.2017-03-17T02:49:16.927 [ERROR] 2017-03-17T02:49:16.927 [ERROR] For more information about the errors and possible solutions, please read the following articles:2017-03-17T02:49:16.928 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException2017-03-17T02:49:16.928 [ERROR] 2017-03-17T02:49:16.928 [ERROR] After correcting the problems, you can resume the build with the command2017-03-17T02:49:16.928 [ERROR] mvn -rf :beam-runners-core-javachannel stoppedSetting status of bac345c to FAILURE with url https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/8511/ and message: 'Build finished. 'Using context: Jenkins: Maven clean install--none-- |
bac345c
to
7b9d764
Compare
Refer to this link for build results (access rights to CI server needed): Build result: FAILURE[...truncated 557.79 KB...] at java.lang.Thread.run(Thread.java:745)Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Java_MavenInstall/runners/core-java/src/test/java/org/apache/beam/runners/core/ReduceFnTester.java:[364,25] no suitable method found for add(W) method java.util.Collection.add(org.apache.beam.runners.core.StateNamespace) is not applicable (argument mismatch; W cannot be converted to org.apache.beam.runners.core.StateNamespace) method java.util.Set.add(org.apache.beam.runners.core.StateNamespace) is not applicable (argument mismatch; W cannot be converted to org.apache.beam.runners.core.StateNamespace) at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1029) at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:170) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 31 more2017-03-17T03:08:40.894 [ERROR] 2017-03-17T03:08:40.894 [ERROR] Re-run Maven using the -X switch to enable full debug logging.2017-03-17T03:08:40.894 [ERROR] 2017-03-17T03:08:40.894 [ERROR] For more information about the errors and possible solutions, please read the following articles:2017-03-17T03:08:40.894 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException2017-03-17T03:08:40.894 [ERROR] 2017-03-17T03:08:40.894 [ERROR] After correcting the problems, you can resume the build with the command2017-03-17T03:08:40.894 [ERROR] mvn -rf :beam-runners-core-javachannel stoppedSetting status of 7b9d764 to FAILURE with url https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/8512/ and message: 'Build finished. 'Using context: Jenkins: Maven clean install--none-- |
7b9d764
to
a9b3c9f
Compare
Refer to this link for build results (access rights to CI server needed): |
PTAL Look to me travis failing is unrelated |
Apologies for the delay; I've been traveling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good!
* <li>{@code spec} could be a glob or a uri. {@link #match} should be able to tell and | ||
* choose efficient implementations. | ||
* <li>The user-provided {@code spec} might refer to files or directories. It is common that | ||
* users that wish to indicate a directory will omit the trailing {@code /}, such as in a spec of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe hint that /
is not the only delimiter, such as \
for windows or other. ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
return parseScheme(spec); | ||
}}) | ||
.toSet(); | ||
checkArgument(schemes.size() == 1, "Expect specs have the same scheme."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the set of schemes to the message for debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}}) | ||
.toSet(); | ||
checkArgument(schemes.size() == 1, "Expect specs have the same scheme."); | ||
return getFileSystemInternal(schemes.iterator().next()).match(specs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iterables.getOnlyElement or something like it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
*/ | ||
public static List<MatchResult> match(List<String> specs) throws IOException { | ||
checkArgument(!specs.isEmpty(), "Expect specs are not empty."); | ||
Set<String> schemes = FluentIterable.from(specs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like it would be good to extract this logic to a common place -- "getOnlyScheme"? This would take a list of resources and assert that they all have the same scheme.
Note that we need this here for String
but also for ResourceId
in all the bulk APIs below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public static void copy( | ||
List<ResourceId> srcResourceIds, | ||
List<ResourceId> destResourceIds, | ||
MoveOptions... moveOptions) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MoveOptions
or CopyOptions
or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following the nio interface, which uses CopyOption in both copy() and move().
https://docs.oracle.com/javase/7/docs/api/java/nio/file/CopyOption.html
(And, I also used the same options in delete()).
I think CopyOptions and RenameOptions could share many configuration options.
If we need copy specific options, we can make CopyOptions to extend MoveOptions. This interface accept both.
srcToCopy = new ArrayList<>(); | ||
destToCopy = new ArrayList<>(); | ||
|
||
List<MatchResult> matchResults = matchResources(srcResourceIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract this logic for ignoring missing files to a common place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public static void rename( | ||
List<ResourceId> srcResourceIds, | ||
List<ResourceId> destResourceIds, | ||
MoveOptions... moveOptions) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RenameOptions
or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -24,16 +24,17 @@ | |||
import com.google.common.collect.ImmutableList; | |||
import com.google.common.collect.Iterables; | |||
import com.google.common.collect.Lists; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
@@ -24,16 +24,17 @@ | |||
import com.google.common.collect.ImmutableList; | |||
import com.google.common.collect.Iterables; | |||
import com.google.common.collect.Lists; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* <li>{@code spec} could be a glob or a uri. {@link #match} should be able to tell and | ||
* choose efficient implementations. | ||
* <li>The user-provided {@code spec} might refer to files or directories. It is common that | ||
* users that wish to indicate a directory will omit the trailing {@code /}, such as in a spec of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
return parseScheme(spec); | ||
}}) | ||
.toSet(); | ||
checkArgument(schemes.size() == 1, "Expect specs have the same scheme."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
*/ | ||
public static List<MatchResult> match(List<String> specs) throws IOException { | ||
checkArgument(!specs.isEmpty(), "Expect specs are not empty."); | ||
Set<String> schemes = FluentIterable.from(specs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}}) | ||
.toSet(); | ||
checkArgument(schemes.size() == 1, "Expect specs have the same scheme."); | ||
return getFileSystemInternal(schemes.iterator().next()).match(specs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
srcToCopy = new ArrayList<>(); | ||
destToCopy = new ArrayList<>(); | ||
|
||
List<MatchResult> matchResults = matchResources(srcResourceIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public static void copy( | ||
List<ResourceId> srcResourceIds, | ||
List<ResourceId> destResourceIds, | ||
MoveOptions... moveOptions) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following the nio interface, which uses CopyOption in both copy() and move().
https://docs.oracle.com/javase/7/docs/api/java/nio/file/CopyOption.html
(And, I also used the same options in delete()).
I think CopyOptions and RenameOptions could share many configuration options.
If we need copy specific options, we can make CopyOptions to extend MoveOptions. This interface accept both.
public static void rename( | ||
List<ResourceId> srcResourceIds, | ||
List<ResourceId> destResourceIds, | ||
MoveOptions... moveOptions) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
That's awesome ! I gonna make try and experiment a filesystem (HDFS/S3 first). Thanks again ! |
Refer to this link for build results (access rights to CI server needed): |
LGTM once green. (Please self-merge.) Right now, seems like Findbugs is finding null pointer exceptions:
|
Refer to this link for build results (access rights to CI server needed): |
Be sure to do all of the following to help us incorporate your contribution
quickly and easily:
[BEAM-<Jira issue #>] Description of pull request
mvn clean verify
. (Even better, enableTravis-CI on your fork and ensure the whole test matrix passes).
<Jira issue #>
in the title with the actual Jira issuenumber, if there is one.
Individual Contributor License Agreement.