Ask Your Question

Revision history [back]

Regarding the way you propose, the answer is no : the jupyter notebook does not know and is not able to save the state of a computation.

I see two options:

  • from inside : you can write checkpoints within your code (e.g. every X iterations) that save, within a file on your disk, all information needed to resume the computation from there. Your function should be written in a way that given such a checkpoint file, comtinue the computation.

  • from outside : in Linux, it is possible to stop a process an resume it later (with STOP and CONT signals). However, Sage launches several processes. An option is to use cgroups. Otherwise, you can run Sage within a virtual machine (e.g. qemu) or a container (e.g. LXC) so that you have control over all Linux processes involved in the computation, those tools provide ways to stop the processes and restart them later (even save the state on the disk if you want to restart them after machine reboot).