[
https://issues.apache.org/jira/browse/FLINK-2613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14948807#comment-14948807
]
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_r41525735
--- Diff:
flink-staging/flink-scala-shell/src/test/scala/org/apache/flink/api/scala/ScalaShellITSuite.scala
---
@@ -225,8 +223,50 @@ class ScalaShellITSuite extends FunSuite with Matchers
with BeforeAndAfterAll {
out.toString + stdout
}
- var cluster: Option[ForkableFlinkMiniCluster] = None
- val parallelism = 4
+ /**
+ * tests flink shell startup with remote cluster (starts cluster
internally)
+ */
+ test("start flink scala shell with remote cluster") {
+
+ val input: String = "val els = env.fromElements(\"a\",\"b\");\n" +
+ "els.print\nError\n:q\n"
+
+ val in: BufferedReader = new BufferedReader(
+ new StringReader(
+ input + "\n"))
+ val out: StringWriter = new StringWriter
+
+ val baos: ByteArrayOutputStream = new ByteArrayOutputStream
+ val oldOut: PrintStream = System.out
+ System.setOut(new PrintStream(baos))
+
+ 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
--- End diff --
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
<[email protected]> 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
> 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)