-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-2850] Clustering CLI - schedule and run command fixes to avoid NumberFormatException #4101
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ | |
| import org.apache.hudi.common.table.timeline.versioning.TimelineLayoutVersion; | ||
| import org.apache.hudi.common.util.Option; | ||
| import org.apache.hudi.common.util.StringUtils; | ||
| import org.apache.hudi.common.util.ValidationUtils; | ||
| import org.apache.hudi.config.HoodieBootstrapConfig; | ||
| import org.apache.hudi.config.HoodieIndexConfig; | ||
| import org.apache.hudi.config.HoodieWriteConfig; | ||
|
|
@@ -79,12 +80,14 @@ enum SparkCommand { | |
| } | ||
|
|
||
| public static void main(String[] args) throws Exception { | ||
| String command = args[0]; | ||
| LOG.info("Invoking SparkMain:" + command); | ||
| ValidationUtils.checkArgument(args.length >= 4); | ||
| final String commandString = args[0]; | ||
| LOG.info("Invoking SparkMain: " + commandString); | ||
| final SparkCommand cmd = SparkCommand.valueOf(commandString); | ||
|
|
||
| SparkCommand cmd = SparkCommand.valueOf(command); | ||
| JavaSparkContext jsc = SparkUtil.initJavaSparkConf("hoodie-cli-" + commandString, | ||
| Option.of(args[1]), Option.of(args[2])); | ||
|
|
||
| JavaSparkContext jsc = SparkUtil.initJavaSparkConf("hoodie-cli-" + command, Option.of(args[1]), Option.of(args[2])); | ||
| int returnCode = 0; | ||
| try { | ||
| switch (cmd) { | ||
|
|
@@ -111,8 +114,8 @@ public static void main(String[] args) throws Exception { | |
| if (args.length > 13) { | ||
| configs.addAll(Arrays.asList(args).subList(13, args.length)); | ||
| } | ||
| returnCode = dataLoad(jsc, command, args[3], args[4], args[5], args[6], args[7], args[8], | ||
| Integer.parseInt(args[9]), args[10], Integer.parseInt(args[11]), propsFilePath, configs); | ||
| returnCode = dataLoad(jsc, commandString, args[3], args[4], args[5], args[6], args[7], args[8], | ||
| Integer.parseInt(args[9]), args[10], Integer.parseInt(args[11]), propsFilePath, configs); | ||
| break; | ||
| case COMPACT_RUN: | ||
| assert (args.length >= 10); | ||
|
|
@@ -159,33 +162,34 @@ public static void main(String[] args) throws Exception { | |
| case COMPACT_UNSCHEDULE_PLAN: | ||
| assert (args.length == 9); | ||
| doCompactUnschedule(jsc, args[3], args[4], args[5], Integer.parseInt(args[6]), | ||
| Boolean.parseBoolean(args[7]), Boolean.parseBoolean(args[8])); | ||
| Boolean.parseBoolean(args[7]), Boolean.parseBoolean(args[8])); | ||
| returnCode = 0; | ||
| break; | ||
| case CLUSTERING_RUN: | ||
| assert (args.length >= 8); | ||
| assert (args.length >= 9); | ||
| propsFilePath = null; | ||
| if (!StringUtils.isNullOrEmpty(args[7])) { | ||
| propsFilePath = args[7]; | ||
| if (!StringUtils.isNullOrEmpty(args[8])) { | ||
| propsFilePath = args[8]; | ||
| } | ||
| configs = new ArrayList<>(); | ||
| if (args.length > 8) { | ||
| configs.addAll(Arrays.asList(args).subList(8, args.length)); | ||
| if (args.length > 9) { | ||
| configs.addAll(Arrays.asList(args).subList(9, args.length)); | ||
| } | ||
| returnCode = cluster(jsc, args[1], args[2], args[3], Integer.parseInt(args[4]), args[5], | ||
| Integer.parseInt(args[6]), false, propsFilePath, configs); | ||
| returnCode = cluster(jsc, args[3], args[4], args[5], Integer.parseInt(args[6]), args[2], | ||
| Integer.parseInt(args[7]), false, propsFilePath, configs); | ||
|
Comment on lines
-175
to
+179
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you want to log a ticket for later improvement: this positional argument pretty hard to maintain, can we adopt jcommander here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, will file a ticket. |
||
| break; | ||
| case CLUSTERING_SCHEDULE: | ||
| assert (args.length >= 6); | ||
| assert (args.length >= 7); | ||
| propsFilePath = null; | ||
| if (!StringUtils.isNullOrEmpty(args[5])) { | ||
| propsFilePath = args[5]; | ||
| if (!StringUtils.isNullOrEmpty(args[6])) { | ||
| propsFilePath = args[6]; | ||
| } | ||
| configs = new ArrayList<>(); | ||
| if (args.length > 6) { | ||
| configs.addAll(Arrays.asList(args).subList(6, args.length)); | ||
| if (args.length > 7) { | ||
| configs.addAll(Arrays.asList(args).subList(7, args.length)); | ||
| } | ||
| returnCode = cluster(jsc, args[1], args[2], args[3], 1, args[4], 0, true, propsFilePath, configs); | ||
| returnCode = cluster(jsc, args[3], args[4], args[5], 1, args[2], | ||
| 0, true, propsFilePath, configs); | ||
| break; | ||
| case CLEAN: | ||
| assert (args.length >= 5); | ||
|
|
@@ -229,7 +233,7 @@ public static void main(String[] args) throws Exception { | |
| break; | ||
| } | ||
| } catch (Throwable throwable) { | ||
| LOG.error("Fail to execute command", throwable); | ||
| LOG.error("Fail to execute commandString", throwable); | ||
| returnCode = -1; | ||
| } finally { | ||
| jsc.stop(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.