Hi,

I'm trying to do a very simple thing - passing a variable (ideally an array, 
but string will do) from an Angular paragraph to a pyspark paragraph. 
Unfortunately I just get the result "None" when printing the value in pyspark.

Setting the variable in my Angular paragraph (I'm using Javascript to do this 
for reasons related to the bigger project I'm working on and this works fine 
for passing to another %angular or %spark.spark paragraph):

%angular

<form id="main_form"></form>
<script>
$( document ).ready(function() {
    angFormScope = 
angular.element(document.getElementById('main_form')).scope(); // Set Angular 
scope variable now document is fully loaded and ready
    angFormScope.testvar = "hello"
});
</script>

Trying to read the variable in my pyspark paragraph:

%spark.pyspark
testvar = z.get("testvar");
print(testvar);

Output: None

However, getting the variable in another angular paragraph works fine.

I also seem to have access to the Zeppelin context in %pyspark and %python 
paragraphs, e.g. these work:

%spark.pyspark
print(z.z);
Output: 
org.apache.zeppelin.spark.SparkZeppelinContext@2cd4a775<mailto:org.apache.zeppelin.spark.SparkZeppelinContext@2cd4a775>

%python
# Gets the user's ID from the system, and puts it in the user_ID bound variable
z.z.angularBind("user_ID", 
z.getInterpreterContext().getAuthenticationInfo().getUser())
Output: gives the user id correctly

%spark.pyspark
z.z.getInterpreterContext().getNoteId()
Output: Gives the note ID correctly.

I notice from the python Zeppelin context source that get() should be available 
but the function call should be "def get(self, key)" - am I supposed to specify 
self somehow? 
https://github.com/apache/zeppelin/blob/master/python/src/main/resources/python/zeppelin_context.py#L58

Think I just need the right syntax here unless there's a bug in Zeppelin 
blocking this from working (unfortunately it's running in a corporate 
environment with Zeppelin 0.8.2).

Thanks for any info.

Alex Kerr

Reply via email to