You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@toree.apache.org by Shally Sangal <sh...@gmail.com> on 2016/01/28 18:13:14 UTC

onResult, onStream, onSuccess callbacks not working

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

Re: onResult, onStream, onSuccess callbacks not working

Posted by Corey Stubbs <ca...@gmail.com>.
Hi Shally. I am looking into this. I was trying to replicate on Thursday,
and was out of the office on Friday. Will post when I get some results.
On Jan 30, 2016 3:02 PM, "Shally Sangal" <sh...@gmail.com> wrote:

> Hi,
>
> Could someone please take a look at this?
>
> Thanks!
>
> On Thu, Jan 28, 2016 at 10:43 PM, Shally Sangal <sh...@gmail.com>
> wrote:
>
> > 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
> >
>

Re: onResult, onStream, onSuccess callbacks not working

Posted by Shally Sangal <sh...@gmail.com>.
Hi,

Could someone please take a look at this?

Thanks!

On Thu, Jan 28, 2016 at 10:43 PM, Shally Sangal <sh...@gmail.com>
wrote:

> 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
>