Skip to content

Commit

Permalink
[HUDI-2850] Clustering CLI - schedule and run command fixes to avoid …
Browse files Browse the repository at this point in the history
…NumberFormatException

 - added java doc on how to run the clustering commands
  • Loading branch information
manojpec committed Nov 26, 2021
1 parent 698b881 commit 89112c7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public class ClusteringCommand implements CommandMarker {

private static final Logger LOG = LogManager.getLogger(ClusteringCommand.class);

/**
* Schedule clustering table service.
* <p>
* Example:
* > connect --path {path to hudi table}
* > clustering schedule --sparkMaster local --sparkMemory 2g
*/
@CliCommand(value = "clustering schedule", help = "Schedule Clustering")
public String scheduleClustering(
@CliOption(key = "sparkMaster", unspecifiedDefaultValue = SparkUtil.DEFAULT_SPARK_MASTER, help = "Spark master") final String master,
Expand Down Expand Up @@ -71,6 +78,14 @@ public String scheduleClustering(
return "Succeeded to schedule clustering for " + clusteringInstantTime;
}

/**
* Run clustering table service.
* <p>
* Example:
* > connect --path {path to hudi table}
* > clustering schedule --sparkMaster local --sparkMemory 2g
* > clustering run --sparkMaster local --sparkMemory 2g --clusteringInstant 20211124005208
*/
@CliCommand(value = "clustering run", help = "Run Clustering")
public String runClustering(
@CliOption(key = "sparkMaster", unspecifiedDefaultValue = SparkUtil.DEFAULT_SPARK_MASTER, help = "Spark master") final String master,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ enum SparkCommand {
}

public static void main(String[] args) throws Exception {
ValidationUtils.checkArgument(args.length >= 4);
final String commandString = args[0];
LOG.info("Invoking SparkMain: " + commandString);
final SparkCommand cmd = SparkCommand.valueOf(commandString);

ValidationUtils.checkArgument(args.length >= 4);
JavaSparkContext jsc = SparkUtil.initJavaSparkConf("hoodie-cli-" + commandString,
Option.of(args[1]), Option.of(args[2]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class HoodieClusteringJob {
public HoodieClusteringJob(JavaSparkContext jsc, Config cfg) {
this.cfg = cfg;
this.jsc = jsc;
this.props = (cfg.propsFilePath == null || cfg.propsFilePath.isEmpty())
this.props = StringUtils.isNullOrEmpty(cfg.propsFilePath)
? UtilHelpers.buildProperties(cfg.configs)
: readConfigFromFileSystem(jsc, cfg);
}
Expand Down

0 comments on commit 89112c7

Please sign in to comment.