Hi,

I am trying a simple command through the client library on a Kernel
instance running locally. The command seems to be executed successfully,
but none of the callbacks are executed.
My code looks like this(the callback methods are taken from a
DocumentationExamples.scala on github):

client.execute("val sqlContext = new org.apache.spark.sql.SQLContext(sc)
;val df= sqlContext" +
      ".range(1,11); val a = df.count(); println(a) ")
      .onError(printError)
    .onSuccess(printSuccess)
    .onResult(printResult)
      .onStream(printStreamContent)

def printResult(result: ExecuteResult) = {
      println(s"Result was: ${result.data.get(MIMEType.PlainText).get}")
    }

    def printStreamContent(content:StreamContent) = {
      println(s"Stream content was: ${content.text}")
    }

    def printSuccess(executeReplyOk: ExecuteReplyOk) = {
      println(s"Successful code completion")
    }

    def printError(reply:ExecuteReplyError) = {
      println(s"Error was: ${reply.evalue.get}")
    }

I don't get any of the prints in this case. If I add some error in the
command like df1.count where df1 does not exist, then onError is called and
the message is printed. However, when the command is executed successfully,
none of the other callbacks are called. I am particularly interested in
capturing the output of the execution.
Would really appreciate some help here.

Thanks,
Shally

Reply via email to