Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to clear values in zeppelin notebook?

avatar

I created a Zeppelin notebook and I added three lines of code to it. "%pyspark", myValue = "4", and "print myValue". I then commented out the second line where I assign 4 to myValue and I ran the notebook: it still remembers that myValue is 4. How do I reset the notebook so that I will not remember values of variables?

4 REPLIES 4

avatar
Guru

Hi @Carlos Barichello

Zeppelin stores these values in a file called note.json. This file is usually stored inside of a directory (the note's ID is usually in the URL for the note, and is the subdirectory name) on the Zeppelin home server, and can be edited in a text editor where you can remove the values/paragraphs if you so require.

Here is a good post showing how to do it: https://community.hortonworks.com/questions/24254/zeppelin-how-to-remove-results-cache-from-notebook...

As always, if you find this post useful, please accept the answer.

avatar

Hi Sonu,

I don't have access to the Zeppelin server: only our admins can get in there. The rest of us are thought of as "Zeppelin users" and the expectation is that we will do our work using the Zeppelin Notebook.

Is there a way to clear the values by running a notebook command such as "ResetValues()" or "StartOver()" or something nice like that?

Thanks for responding to the post.

Carlos -

avatar
Guru

Hi @Carlos Barichello

I haven't seen anything like that yet. The closest would the API or GUI feature to clear the results from the paragraph, but, that doesn't erase the cache from previous results. The only way I've seen is to edit the JSON file. I suppose though that you could also just reuse the variable in another paragraph to make it useful again?

avatar

We restarted Zeppelin and the variables got cleared. That's good because the variables got cleared. That's not good because we can't have a user calling the system administrator to restart Zeppelin just because the user wants the variables in their notebook cleared. My actual problem is that I have a large notebook with many cells and lots of code. So if I rename a variable in a few cells, but I forget to rename it in another cell, my program will keep running since the old variables are held in memory. A Zeppelin restart is then necessary for me to find out that the notebook is actually not going to work. There must be a way to easily reset all variables. If it was just my code, I would not be worried. But we are about to release Zeppelin to our users: it is a matter of time before someone runs into this problem.

We also use a product here called Databricks which runs notebooks of their own. The same type of problem exists there, but they give you two ways to take care of the problem. One is by running the command "%reset -f' in a cell. I tried that in Zeppelin and it did not work.