Hi moon, Thanks very much for the workaround. Rather than go through all my methods to add an extra parameter for the InterpreterContext I decided to pass it in once to a new setup() method which then keeps a reference to it for use by the other methods. It’s not as user-friendly as before because now the user has to call setup(z.getInterpreterContext()) before they call any of the other methods but hopefully it will work…
Hmm, on testing it looks like I will need to pass in InterpreterContext once *per paragraph* because the InterpreterContext instance appears to change between paragraphs too… Oh well! Thanks for your help, Lucas. From: moon soo Lee [mailto:m...@apache.org] Sent: 13 October 2015 12:31 To: users@zeppelin.incubator.apache.org Subject: Re: How to find out if a user's Scala commands are executing in the same Zeppelin paragraph? Hi, "org.apache.zeppelin" % "zeppelin-interpreter" % "0.5.0-incubating' Will provide class for InterpreterContext. However ZeppelinContext is inside of "org.apache.zeppelin" % "spark" and it is not published to public maven repository. So, you can add "org.apache.zeppelin" % "zeppelin-interpreter" % "0.5.0-incubating" as dependency of your scala code. And everytime you call your scala code in the paragraph, you can pass InterpreterContext to your class/function. Is this approach okay for your case? Best, moon On Tue, Oct 13, 2015 at 1:05 PM Partridge, Lucas (GE Aviation) <lucas.partri...@ge.com<mailto:lucas.partri...@ge.com>> wrote: Hi moon, Sorry – I should’ve asked this before. How can I make use of “z.getInterpreterContext().getParagraphId()” in my own Scala code which I’m building outside of Zeppelin, please? I’ve added this line to the scala file where I make the calls: import org.apache.zeppelin.spark.ZeppelinContext and I’ve added this line to my libraryDependencies in my sbt build file: "org.apache.zeppelin" % "zeppelin" % "0.5.0-incubating" but when I try to compile I get this error first: [error] …. object zeppelin is not a member of package org.apache [error] import org.apache.zeppelin.spark.ZeppelinContext [error] ^ When I look in my .ivy2 cache I see there are no jars under org.apache.zeppelin/zeppelin. Also, there are no jars on maven central at http://repo1.maven.org/maven2/org/apache/zeppelin/zeppelin/0.5.0-incubating/<https://urldefense.proofpoint.com/v2/url?u=http-3A__repo1.maven.org_maven2_org_apache_zeppelin_zeppelin_0.5.0-2Dincubating_&d=BQMFaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=c1CCNND4PG-Q_V2AJWDWrugZAXQ8Y3EE_f_mAHcpXcs&m=kANvf78ADS7-6Flu-9_2opb242HYlQzuWjzb-umWlK8&s=uusoVdVbG2ds4AKU5qO0jiG2haP4FxOIfho98YsS0lA&e=> either! Is this what would you expect, or do the binaries for that release need publishing to maven central please? Or should I build zeppelin-0.5.0-incubating locally instead? Many thanks, Lucas. From: Partridge, Lucas (GE Aviation) Sent: 13 October 2015 09:56 To: users@zeppelin.incubator.apache.org<mailto:users@zeppelin.incubator.apache.org> Subject: RE: How to find out if a user's Scala commands are executing in the same Zeppelin paragraph? Thanks moon; that’s exactly what I wanted☺. I confirm it works for me in standalone zeppelin-0.5.0-incubating. I get strings back with date/time stamps and a unique ID that differs between paragraphs. Thanks again, Lucas. From: moon soo Lee [mailto:m...@apache.org] Sent: 12 October 2015 17:17 To: users@zeppelin.incubator.apache.org<mailto:users@zeppelin.incubator.apache.org> Subject: Re: How to find out if a user's Scala commands are executing in the same Zeppelin paragraph? Hi Lucas, You can get current paragraph Id by calling %spark z.getInterpreterContext().getParagraphId() I'm not quite sure i understand your question correctly, but hope this helps. Thanks, moon On Mon, Oct 12, 2015 at 5:29 PM Partridge, Lucas (GE Aviation) <lucas.partri...@ge.com<mailto:lucas.partri...@ge.com>> wrote: Does anyone please know how to find out what paragraph your Scala code is running in at runtime? I’m using the standalone distribution of Zeppelin, zeppelin-0.5.0-incubating.tgz. I want to write some Scala code that does one thing if it’s being executed in the same paragraph as another call to my code, but another if it’s executing in a different paragraph to the other call. (Specifically I want to create a new figure or chart if it’s running in a new paragraph, or add to an existing figure if it’s running in the same paragraph.) Many thanks, Lucas.