Skip to content
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

[FLINK-2613] Print usage information for Scala Shell #1106

Closed

Conversation

nikste
Copy link
Contributor

@nikste nikste commented Sep 8, 2015

changed startup of scala shell

@StephanEwen
Copy link
Contributor

Looks good. Is it possible that we cover both cases with tests?

  1. Start the shell in local mode, submit some commands.
  2. Start a ForkableFlinkMiniCluster, and start the shell in mode remote "localhost" cluster.getJobManagerRpcPort()?

@nikste nikste force-pushed the FLINK-2613-enhanced-help-message branch 4 times, most recently from 9ef4470 to f835a0f Compare September 14, 2015 13:29
@fhueske
Copy link
Contributor

fhueske commented Sep 15, 2015

The tests use the shell scripts (.sh or .bat) to start the Scala Shell and rely on finding these scripts in the flink-dist/target folder. I think this is a bit fragile. Why not directly using the FlinkShell.scala class?

@nikste nikste force-pushed the FLINK-2613-enhanced-help-message branch 3 times, most recently from 659f868 to e714c7a Compare September 16, 2015 12:30


/**
* Created by nikste on 9/16/15.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this comment

@nikste nikste force-pushed the FLINK-2613-enhanced-help-message branch 2 times, most recently from 156716e to 135ca75 Compare September 17, 2015 12:31
@nikste
Copy link
Contributor Author

nikste commented Sep 17, 2015

Should be fixed according to your comments @fhueske

*/
test("start flink scala shell with remote cluster") {

val input: String = "val els = env.fromElements(\"a\",\"b\");\n" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a check, that the program was actually executed for example by checking that the correct output was produced?

@fhueske
Copy link
Contributor

fhueske commented Sep 17, 2015

Thanks for the update @nikste! I have only one minor thing to add.
After that it's good to merge, IMO.
Thanks!

@nikste nikste force-pushed the FLINK-2613-enhanced-help-message branch from 135ca75 to b3c7d01 Compare September 18, 2015 08:33
@rmetzger
Copy link
Contributor

@nikste, since you need to change the pull request again, can you also fix the directory name of the classes
flink-staging/flink-scala-shell/src/main/scala/org.apache.flink/api/scala/FlinkShell.scala

@nikste nikste force-pushed the FLINK-2613-enhanced-help-message branch from b3c7d01 to 40f4253 Compare September 21, 2015 08:32
@nikste
Copy link
Contributor Author

nikste commented Sep 21, 2015

@fhueske, good point to check if the program was actually executed! @rmetzger fixed the directory structure as well.

@chiwanpark
Copy link
Member

@nikste Could you renaming the directory by using git mv command? Currently, FlinkShell.scala loses all commit histories. FlinkILoop.scala seems okay.

@nikste
Copy link
Contributor Author

nikste commented Sep 30, 2015

@chiwanpark I moved the files with git mv, however they still don't show the history.
This seems to be more of a gui thing of github according to:

http://stackoverflow.com/questions/31304441/i-moved-all-my-project-files-with-git-mv-but-i-have-lost-all-my-history-why

However, the history still exists and can be accessed via:

git log --follow <some path to a moved file>

@nikste nikste reopened this Sep 30, 2015
@sachingoel0101
Copy link
Contributor

Hey @nikste , you should rebase this to the current master.

@@ -68,38 +94,62 @@ object FlinkShell {

def startShell(
userHost : String,
userPort : Int,
userPort : Int,
executionMode : ExecutionMode.Value,
externalJars : Option[Array[String]] = None): Unit ={
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove space after parameter name like following:

def startShell(
  userHost: String,
  userPort: Int,
  executionMode: ExecutionMode.value

@chiwanpark
Copy link
Member

Hi @nikste, thanks for update. It looks good to merge except some style issues.

@nikste nikste force-pushed the FLINK-2613-enhanced-help-message branch from d4997d0 to 0bad350 Compare October 8, 2015 12:16
@nikste
Copy link
Contributor Author

nikste commented Oct 8, 2015

@chiwanpark, white line issues are now fixed.

@chiwanpark
Copy link
Member

Okay, if there is no objection and the travis passes, I'll merge this.

miniCluster.start()
val port = miniCluster.getLeaderRPCPort
println(s"\nStarting local Flink cluster (host: localhost, port: $port).\n")
("localhost",port, Some(miniCluster))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a space after ,.

@chiwanpark
Copy link
Member

@nikste Sorry for bothering you, but there are still some style issues. Looks good to merge except the issues.

// buffered reader for testing
FlinkShell.bufferedReader = Some(in)
FlinkShell.main(args)
baos.flush
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the return type of method or function is Unit, adding parenthesis after name is recommended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the official reasoning is if it has some "side-effects" it should have some parenthesis (which it does in this case)
http://docs.scala-lang.org/style/method-invocation.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, right. And almost all the method of which return type is Unit have some side-effects. :)

On Oct 8, 2015, at 5:05 PM, Nikolaas Steenbergen notifications@github.com wrote:

In flink-staging/flink-scala-shell/src/test/scala/org/apache/flink/api/scala/ScalaShellITSuite.scala:

  • val (c, args) = cluster match{
  •  case Some(cl) =>
    
  •    val arg = Array("remote",
    
  •      cl.hostname,
    
  •      Integer.toString(cl.getLeaderRPCPort))
    
  •    (cl, arg)
    
  •  case None =>
    
  •    fail("Cluster creation failed!")
    
  • }
  • //start scala shell with initialized
  • // buffered reader for testing
  • FlinkShell.bufferedReader = Some(in)
  • FlinkShell.main(args)
  • baos.flush

Actually the official reasoning is if it has some "side-effects" it should have some parenthesis (which it does in this case)
http://docs.scala-lang.org/style/method-invocation.html


Reply to this email directly or view it on GitHub.

Regards,
Chiwan Park

@nikste nikste force-pushed the FLINK-2613-enhanced-help-message branch 2 times, most recently from 05c06dc to 5fb4738 Compare October 8, 2015 14:44
@nikste
Copy link
Contributor Author

nikste commented Oct 8, 2015

@chiwanpark issues should be fixed now..

changed startup of scala shell
user has to specify local or remote mode explicitly now.
@nikste nikste force-pushed the FLINK-2613-enhanced-help-message branch from 5fb4738 to e3e311b Compare October 8, 2015 14:57
@nikste
Copy link
Contributor Author

nikste commented Oct 8, 2015

@chiwanpark issues should be fixed NOW ;)

@asfgit asfgit closed this in 7750a1f Oct 9, 2015
@chiwanpark
Copy link
Member

Merging...

cfmcgrady pushed a commit to cfmcgrady/flink that referenced this pull request Oct 23, 2015
  - Change startup code of scala shell
  - User has to specify local or remote mode explicitly now.

This closes apache#1106.
lofifnc pushed a commit to lofifnc/flink that referenced this pull request Oct 23, 2015
  - Change startup code of scala shell
  - User has to specify local or remote mode explicitly now.

This closes apache#1106.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants