[
https://issues.apache.org/jira/browse/FLINK-2613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14948723#comment-14948723
]
ASF GitHub Bot commented on FLINK-2613:
---------------------------------------
Github user chiwanpark commented on a diff in the pull request:
https://github.com/apache/flink/pull/1106#discussion_r41518461
--- Diff:
flink-staging/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala
---
@@ -18,48 +18,74 @@
package org.apache.flink.api.scala
+import java.io.{StringWriter, BufferedReader}
+
+import org.apache.flink.api.common.ExecutionMode
+
import org.apache.flink.configuration.Configuration
import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster
import scala.tools.nsc.Settings
+import scala.tools.nsc.interpreter._
+
object FlinkShell {
+ object ExecutionMode extends Enumeration {
+ val UNDEFINED, LOCAL, REMOTE = Value
+ }
+
+ var bufferedReader: Option[BufferedReader] = None
+
def main(args: Array[String]) {
// scopt, command line arguments
case class Config(
port: Int = -1,
host: String = "none",
- externalJars: Option[Array[String]] = None)
+ externalJars: Option[Array[String]] = None,
+ flinkShellExecutionMode: ExecutionMode.Value =
ExecutionMode.UNDEFINED)
+
val parser = new scopt.OptionParser[Config]("start-scala-shell.sh") {
head ("Flink Scala Shell")
- opt[Int] ('p', "port") action {
- (x, c) =>
- c.copy (port = x)
- } text("port specifies port of running JobManager")
-
- opt[(String)] ('h',"host") action {
- case (x, c) =>
- c.copy (host = x)
- } text("host specifies host name of running JobManager")
-
- opt[(String)] ('a',"addclasspath") action {
- case (x,c) =>
- val xArray = x.split(":")
- c.copy(externalJars = Option(xArray))
- } text("specifies additional jars to be used in Flink")
-
- help("help") text("prints this usage text")
+ cmd("local") action {
+ (_, c) => c.copy(host = "none", port = -1, flinkShellExecutionMode
= ExecutionMode.LOCAL)
+ } text("starts Flink scala shell with a local Flink cluster\n")
children(
+ opt[(String)] ("addclasspath") abbr("a")
valueName("<path/to/jar>") action {
+ case (x, c) =>
+ val xArray = x.split(":")
+ c.copy(externalJars = Option(xArray))
+ } text("specifies additional jars to be used in Flink\n")
+ )
+
+ cmd("remote") action { (_, c) =>
+ c.copy(flinkShellExecutionMode = ExecutionMode.REMOTE)
+ } text("starts Flink scala shell connecting to a remote cluster\n")
children(
+ arg[String]("<host>") action { (h, c) =>
+ c.copy(host = h) }
+ text("remote host name as string"),
+ arg[Int]("<port>") action { (p, c) =>
+ c.copy(port = p) }
+ text("remote port as integer\n"),
+ opt[(String)]("addclasspath") abbr("a") valueName("<path/to/jar>")
action {
+ case (x, c) =>
+ val xArray = x.split(":")
+ c.copy(externalJars = Option(xArray))
+ } text("specifies additional jars to be used in Flink")
+
--- End diff --
Unnecessary new line
> Print usage information for Scala Shell
> ---------------------------------------
>
> Key: FLINK-2613
> URL: https://issues.apache.org/jira/browse/FLINK-2613
> Project: Flink
> Issue Type: Improvement
> Components: Scala Shell
> Affects Versions: 0.10
> Reporter: Maximilian Michels
> Assignee: Nikolaas Steenbergen
> Priority: Minor
> Labels: starter
> Fix For: 0.10
>
>
> The Scala Shell startup script starts a {{FlinkMiniCluster}} by default if
> invoked with no arguments.
> We should add a {{--help}} or {{-h}} option to make it easier for people to
> find out how to configure remote execution. Alternatively, we could print a
> notice on the local startup explaining how to start the shell in remote mode.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)