Notebooks

Notebooks are a way to work interactively with code. You can learn more about notebooks on Jupyter webpage.

Using Notebooks in Neptune

To create a new Neptune notebook, select “Start Notebook” from the top panel. Similarly to regular experiments, you can choose:

  • project and experiment name;
  • worker type;
  • python version and environment;
  • optional .ipynb script;
  • a list of additional input files/directories from cloud storage.

Read more about environments and workers here

start notebook screenshot

You can optionally choose an existing notebook .ipynb file from your local filesystem, which will run as a notebook in Neptune. If no such file is provided, newly created notebook will start as an empty one.

All the specified inputs are accessible in notebook’s /input directory. For example, let’s assume you have dataset.mat in your project’s /uploads. When you start a notebook, you can add dataset.mat as an input (see the picture above). Then, from the notebook code, you can refer to it as /input/dataset.mat.

You can use the ctx object to send channels to Neptune. Each notebook has Neptune’s Python Client Library imported by default and all of its functionality is accessible via ctx. For instance, you can use channels, like in any other experiment:

ctx.channel_send('channel_name', 42)

If, at some point, you want to rerun part of your experiment in the same notebook, you can remove all values from your channels:

ctx.channel_reset('channel_name')

Resetting and Deleting Channels

If, after restarting jupyter notebook kernel, you want to delete or reset all channels, you can do so using:

ctx.delete_all_channels()

or

ctx.reset_all_channels()

Stopping Notebooks

At any time, you can stop the running notebook so that it releases the resources (and doesn’t generate costs any more). Each running notebook will stop automatically after 3 hours of inactivity.

Exporting and Importing Notebooks

Notebooks are saved in experiment storage directory, so you can upload and download them just as any other files on the storage.

Read more about using your storage in experiments here.

You can also use download and upload options directly from the notebook UI.

Starting notebooks from CLI

You can start a notebook using neptune experiment send-notebook command. It will upload all files from your current directory, so that you can use them inside your notebook.