[FLINK-9554][scala-shell] Respect customCommandlines This closes #6140.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/80be8e19 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/80be8e19 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/80be8e19 Branch: refs/heads/master Commit: 80be8e19512c19fe4811e7dcfb6da40791fec79b Parents: fb37d51 Author: Jeff Zhang <zjf...@apache.org> Authored: Thu Jun 7 17:47:32 2018 +0800 Committer: zentol <ches...@apache.org> Committed: Wed Jul 4 17:12:57 2018 +0200 ---------------------------------------------------------------------- .../org/apache/flink/client/cli/CliFrontend.java | 4 ++++ .../org/apache/flink/api/scala/FlinkShell.scala | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/80be8e19/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java ---------------------------------------------------------------------- diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java index e9a1590..e2a260c 100644 --- a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java +++ b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java @@ -166,6 +166,10 @@ public class CliFrontend { return copiedConfiguration; } + public Options getCustomCommandLineOptions() { + return customCommandLineOptions; + } + // -------------------------------------------------------------------------------------------- // Execute Actions // -------------------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/80be8e19/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala ---------------------------------------------------------------------- diff --git a/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala b/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala index b74a8a0..ae22d87 100644 --- a/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala +++ b/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala @@ -20,6 +20,7 @@ package org.apache.flink.api.scala import java.io._ +import org.apache.commons.cli.{CommandLine, Options} import org.apache.flink.client.cli.{CliFrontend, CliFrontendParser} import org.apache.flink.client.deployment.ClusterDescriptor import org.apache.flink.client.program.ClusterClient @@ -28,6 +29,7 @@ import org.apache.flink.runtime.akka.AkkaUtils import org.apache.flink.runtime.minicluster.{MiniCluster, MiniClusterConfiguration, StandaloneMiniCluster} import scala.collection.mutable.ArrayBuffer +import scala.collection.JavaConverters._ import scala.tools.nsc.Settings import scala.tools.nsc.interpreter._ @@ -273,14 +275,14 @@ object FlinkShell { yarnConfig.queue.foreach((queue) => args ++= Seq("-yqu", queue.toString)) yarnConfig.slots.foreach((slots) => args ++= Seq("-ys", slots.toString)) - val commandLine = CliFrontendParser.parse( - CliFrontendParser.getRunCommandOptions, - args.toArray, - true) - - val frontend = new CliFrontend( - configuration, + val frontend = new CliFrontend(configuration, CliFrontend.loadCustomCommandLines(configuration, configurationDirectory)) + + val commandOptions = CliFrontendParser.getRunCommandOptions + val commandLineOptions = CliFrontendParser.mergeOptions(commandOptions, + frontend.getCustomCommandLineOptions()); + val commandLine = CliFrontendParser.parse(commandLineOptions, args.toArray, true) + val customCLI = frontend.getActiveCustomCommandLine(commandLine) val clusterDescriptor = customCLI.createClusterDescriptor(commandLine)