Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/flink/pull/1581#discussion_r51874764
--- Diff:
flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/distcp/DistCp.java
---
@@ -62,18 +63,32 @@
public static final String FILES_COPIED_CNT_NAME = "FILES_COPIED";
public static void main(String[] args) throws Exception {
- if (args.length != 3) {
- printHelp();
+
+ // set up the execution environment
+ final ExecutionEnvironment env =
ExecutionEnvironment.getExecutionEnvironment();
+
+ ParameterTool params = ParameterTool.fromArgs(args);
+ if (!params.has("input") || !params.has("output")) {
+ System.err.println("Usage: --input <path> --output
<path> [--parallelism <n>]");
return;
}
- final Path sourcePath = new Path(args[0]);
- final Path targetPath = new Path(args[1]);
- int parallelism = Integer.valueOf(args[2], 10);
+ final Path sourcePath = new Path(params.get("input"));
+ final Path targetPath = new Path(params.get("output"));
+ if (!isLocal(env) && !(isOnDistributedFS(sourcePath) &&
isOnDistributedFS(targetPath))) {
+ System.out.println("In a distributed mode only HDFS
input/output paths are supported");
+ return;
+ }
+
+ final int parallelism =
Integer.valueOf(params.getInt("parallelism", 10));
--- End diff --
The Integer.valueOf() is not needed.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---