flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chiwanpark <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2613] Print usage information for Scala...
Date Thu, 08 Oct 2015 11:54:52 GMT
Github user chiwanpark commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1106#discussion_r41503815
  
    --- Diff: flink-staging/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala
---
    @@ -68,38 +94,62 @@ object FlinkShell {
     
       def startShell(
           userHost : String, 
    -      userPort : Int, 
    +      userPort : Int,
    +      executionMode : ExecutionMode.Value,
           externalJars : Option[Array[String]] = None): Unit ={
         
         println("Starting Flink Shell:")
     
    -    var cluster: LocalFlinkMiniCluster = null
    -
         // either port or userhost not specified by user, create new minicluster
    -    val (host,port) = if (userHost == "none" || userPort == -1 ) {
    -      println("Creating new local server")
    -      cluster = new LocalFlinkMiniCluster(new Configuration, false)
    -      cluster.start()
    -      ("localhost",cluster.getLeaderRPCPort)
    -    } else {
    -      println(s"Connecting to remote server (host: $userHost, port: $userPort).")
    -      (userHost, userPort)
    +    val (host : String, port : Int, cluster :  Option[LocalFlinkMiniCluster]) =
    +
    +    executionMode match {
    +      case ExecutionMode.LOCAL =>
    +        val miniCluster = new LocalFlinkMiniCluster(new Configuration, false)
    +        miniCluster.start()
    +        val port = miniCluster.getLeaderRPCPort
    +        println(s"\nStarting local Flink cluster (host: localhost, port: $port).\n")
    +        ("localhost",port, Some(miniCluster))
    +
    +      case ExecutionMode.REMOTE =>
    +        if (userHost == "none" || userPort == -1) {
    +          println("Error: <host> or <port> not specified!")
    +          return
    +        } else {
    +          println(s"\nConnecting to Flink cluster (host: $userHost, port: $userPort).\n")
    +          (userHost, userPort, None)
    +        }
    +
    +      case ExecutionMode.UNDEFINED =>
    +        println("Error: please specify execution mode:")
    +        println("[local | remote <host> <port>]")
    +        return
         }
    -    
    -    // custom shell
    -    val repl = new FlinkILoop(host, port, externalJars) //new MyILoop();
     
    -    repl.settings = new Settings()
    +    try {
    +      // custom shell
    +      val repl : FlinkILoop =
    --- End diff --
    
    Space after parameter name


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message