Saving and Restoring Notebook State¶
Warning
It is only possible to save and restore notebook state on Determined clusters that are configured with a shared filesystem available to all agents.
To ensure that your work is saved even if your notebook gets terminated,
it is recommended to launch all notebooks with a shared filesystem
directory bind-mounted into the notebook container and work on files
inside of the bind mounted directory. For example, a user jimmy
with
a shared filesystem home directory at /shared/home/jimmy
could use
the following configuration to launch a notebook:
$ cat > config.yaml << EOL
bind_mounts:
- host_path: /shared/home/jimmy
container_path: /shared/home/jimmy
EOL
$ det notebook start --config-file config.yaml
Working on a notebook file within the shared bind mounted directory will
ensure that your code and Jupyter checkpoints are saved on the shared
filesystem rather than an ephemeral container filesystem. If your
notebook gets terminated, launching another notebook and loading the
previous notebook file will effectively restore the session of your
previous notebook. To restore the full notebook state (in addition to
code), you can use Jupyter’s File
> Revert to Checkpoint
functionality.
Note
By default, JupyterLab will take a checkpoint every 120 seconds in an
.ipynb_checkpoints
folder in the same directory as the notebook file. To
modify this setting, click on Settings
> Advanced Settings Editor
and
change the value of "autosaveInternal"
under Document Manager
.