Ask Your Question

Revision history [back]

You can find the PID of the working process by typing os.getpid() in the worksheet. So to do what you want now, try the following:

  1. In the first worksheet (the one you may want to pause), type os.getpid() and note the PID.
  2. Start something that will take a long time (e.g., factor(2^997-1)) going in the first worksheet.
  3. In a second worksheet, type import signal; os.kill(that pid above, signal.SIGSTOP). The first worksheet will appear to be running, but will not use any CPU resources, as you can confirm with top on the server.
  4. Now in the second worksheet, type os.kill(that pid above, signal.SIGCONT). You will see in top that the Python process associated with the first worksheet is back and burning resources.

The point of the above exercise is that it illustrates that a pause feature could fully work. To really do this right, one would need to add something to the Sage Notebook itself, e.g., modify the sagenb spkg. This would involve some GUI design choices, etc.