2021年3月30日星期二

How to cause Jupiter Lab to save notebook (programmatically)

I have a notebook that runs overnight, and prints out a bunch of stuff, including images and such. I want to cause this output to be saved programatically (perhaps at certain intervals). I also want to save the code that was run. In a Jupyter notebook, you could do:

from IPython.display import display, Javascript  display(Javascript('IPython.notebook.save_checkpoint();'))  # causes the current .ipynb file to save itself (same as hitting CTRL+s)  

(from Save an IPython notebook programmatically from within itself?)

Although, I found that this javascript injection did not work in Jupyter lab(Jupyter not found). My question is how to do the equivalent of the above code in Jupyter lab. Upon inspecting the HTML of the jupyter lab, I could not find the Jupyter object.

https://stackoverflow.com/questions/66880698/how-to-cause-jupiter-lab-to-save-notebook-programmatically March 31, 2021 at 10:06AM

没有评论:

发表评论