Thank you, Thomas.

So, even in theory, the JavaScript that fires on the Close & Halt button
could not be called by injecting %%javascript ?



On Wednesday, November 9, 2016, Thomas Kluyver <[email protected]> wrote:

> I don't think there's a great way to do exactly that. If you want to run
> notebooks unsupervised, you can do so in a headless fashion with 'jupyter
> nbconvert --execute', which will start a kernel, run the notebook and stop
> the kernel again.
>
> We are planning to expose more information so you can see how long a
> notebook has been idle.
>
> On 8 November 2016 at 11:43, Jeremy Douglass <[email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
>> Can a Jupyter notebook programmatically halt itself, such that it no
>> longer appears in the "Running" tab?
>>
>> At the end of a notebook "Run All", I would like the last notebook cell
>> to contain code, and for that code to trigger the equivalent of:
>>
>>    - the "Running tab > Shutdown notebook" action
>>    - ...or, failing that, the "Close and Halt" menu item
>>    - ...or, failing that, the "Kernel > Interrupt" menu item
>>
>> Can this be done with javascript, or with %magic, or something else?
>>
>> I am running the Docker image Jupyer Datascience Notebook
>> <https://github.com/jupyter/docker-stacks/blob/master/datascience-notebook/Dockerfile>,
>> not JupyterHub.
>>
>> I have tried to review related information, but none of these answered my
>> question:
>>
>>    1. keyboard shortcuts to close and halt
>>    <https://github.com/jupyter/notebook/issues/1097>
>>    2. handling leftover singlehubs and kernels
>>    <https://groups.google.com/forum/#!msg/jupyter/sRhbV9UOwIw/Pwq23I_YAAAJ>
>>    3. server cleanup on browser-exit notebooks
>>    <https://groups.google.com/forum/#!msg/jupyter/Qqd2MeL9R1g/jyS4mawADQAJ>
>>    4. the cull-idle script for JupyterHub
>>    <https://github.com/jupyterhub/jupyterhub/tree/master/examples/cull-idle>
>>    5. request to automatically shut down inactive notebooks
>>    <https://github.com/ipython/ipython/issues/5539>
>>
>>
>> In certain use cases, idle notebook cruft is a huge problem. Information
>> isn't exposed that makes identifying an idle notebook easier, and tools for
>> culling notebooks are still wishlist items -- the consensus is it is hard
>> to define idle, and hard to intervene with the browser in certain ways
>> (e.g. event-on-tab-close).
>>
>> I'm trying to cut the gordian knot by having a run-all notebook
>> explicitly declare the notebook is halted / interrupted / done / closed as
>> its last act. This seems like it should be possible, as it is a consequence
>> of a user action (Run).
>>
>> Is it possible? Or are there other ways of accomplishing this?
>>
>>
>> --
>> 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]
>> <javascript:_e(%7B%7D,'cvml','jupyter%[email protected]');>.
>> To post to this group, send email to [email protected]
>> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/jupyter/9b9d0a4e-b5f9-44b6-8504-1918bea15590%40googlegroups.com
>> <https://groups.google.com/d/msgid/jupyter/9b9d0a4e-b5f9-44b6-8504-1918bea15590%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Project Jupyter" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jupyter/3zAVHofQykg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected]
> <javascript:_e(%7B%7D,'cvml','jupyter%[email protected]');>.
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jupyter/CAOvn4qieyMy605EzC5C4f_tMLFGAU7OKm4gPc15EQ25J%
> 2B0gWaw%40mail.gmail.com
> <https://groups.google.com/d/msgid/jupyter/CAOvn4qieyMy605EzC5C4f_tMLFGAU7OKm4gPc15EQ25J%2B0gWaw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAMd1WcCWXL1oTN2NApKPVHDQ25WF4W2Nb8%3D1DmkRewrc1M71QA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to