I have a follow-up question.

Now that we are successfully halting notebooks when they finish running. 
The "No Kernel" message is subtle; in order to better inform users that 
their notebook is halted (and should either be closed or restarted) I am 
using a modal popup as per "Dialog popup in Jupyter notebook" 
(http://stefaanlippens.net/jupyter-notebook-dialog.html) that says 
"NOTEBOOK HALTED" and offers a "Restart Kernel" button.

Currently, the %%javascript cell successfully halts the notebook and 
displays the popup.

I would like to have the dialog button trigger a kernel restart with 
Jupyter.notebook.session.restart(). That command works fine in a 
%%javascript cell on its own and correctly restarts the kernel. However, 
adding that command to the dialog button does nothing. I am not a 
Javascript programmer, and may be making a very basic error. Any 
suggestions?

This is the cell at the end of a notebook that halts the kernel and 
displays the restart dialog:

%%javascript
require(
    ["base/js/dialog"], 
    function(dialog) {
        dialog.modal({
                title: 'Notebook halted!',
                body: 'This notebook is no longer running; the kernel has 
been halted. To continue working, restart the kernel.',
                buttons: {
                    'Kernel restart': { 
function(){Jupyter.notebook.session.restart();} }
                }
        });
    }
);
Jupyter.notebook.session.delete();



On Thursday, November 10, 2016 at 1:21:38 PM UTC-8, Peter Parente wrote:
>
> Thanks for writing back letting others know it worked, Jeremy!
>
> Pete
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/8f237c78-5eaa-4cc8-8a79-4a6b69e0c02a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to