Restoring computation output after disconnect in Jupyter notebook

11,285 views
Skip to first unread message

Brian Cheung

unread,
Jul 10, 2015, 8:03:25 PM7/10/15
to jup...@googlegroups.com
Hi,
  Is there a way to restore the output of a notebook after a disconnect? I usually leave computations running on a server and disconnect/suspend my laptop. Unfortunately, when I go to reconnect to the notebook I lose the realtime output that was printing while I was disconnected. Furthermore, it no longer prints new outputs. Is there a workaround for this issue? Printing to a file kind of defeats much of the reason to use the notebook in the first place.

-Brian


Maximilian Albert

unread,
Jul 13, 2015, 3:57:18 PM7/13/15
to jup...@googlegroups.com
Hi Brian,

The core devs will be able to provide more details, but I can answer at least one aspect of your question: when you disconnect from the server the kernel will still be running and doing computations. I have found that after reconnecting I need to close the browser tab with the notebook and re-open it (*without* restarting the kernel in the dashboard). Then the output of newly executed cells will be printed again (however, I don't know if there is a way to easily retrieve the output of the cell that was running while you disconnected). I have wondered whether it would be possible to avoid this extra step of closing/re-opening the notebook tab but I don't know if the current kernel architecture allows this. Maybe the Jupyter team can expand on these observations/questions.

Cheers,
Max

--
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 jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/03d80f42-a1c4-4ad0-81b6-49c2c3d3da41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MinRK

unread,
Jul 14, 2015, 4:29:20 PM7/14/15
to jup...@googlegroups.com
Since the translation of kernel output message -> output in the notebook document happens in the browser, any outputs that arrive when a browser is not connected are lost. Further, when reopening a notebook with the same browser, not enough information is preserved to resume receiving outputs in the right place. We are working on a different model where more of the notebook state is actually produced on the server, in which case closing your browser will not result in lots output, but we are not there, yet.

I hope that helps,
-MinRK


Douglas La Rocca

unread,
Jul 14, 2015, 6:18:25 PM7/14/15
to jup...@googlegroups.com
Printing to a file is probably the best option. Just as an exercise, here's a context manager that will "tee" (like the unix command) everything to a StringIO buffer: https://bpaste.net/show/c6793001298d


For more options, visit https://groups.google.com/d/optout.



--
Douglas La Rocca

Brian Cheung

unread,
Jul 17, 2015, 10:31:15 PM7/17/15
to jup...@googlegroups.com
Glad to hear there's something in the works to address this. For now I guess I'll stick with the workaround of just saving checkpoints to disk.

-Brian

jl...@canopylabs.com

unread,
Sep 14, 2015, 10:48:51 AM9/14/15
to Project Jupyter
Hi Jupyter Developer,

I'm intersted in knowing the status of the feature. Is it something that will be addressed in the upcoming release?

Best Regards,

jerry

Matthias Bussonnier

unread,
Sep 14, 2015, 12:09:52 PM9/14/15
to jup...@googlegroups.com
Hi Jerry,

> On Sep 14, 2015, at 07:48, jl...@canopylabs.com wrote:
>
> Hi Jupyter Developer,
>
> I'm intersted in knowing the status of the feature. Is it something that will be addressed in the upcoming release?

It’s planned but not close to be done I wouldn’t bet on it being in the next release.
It needs significant refactor for it to work, and right now the amount of maintenance
work to be done make new features implementation not fast.

Thanks,
--
M

hadim

unread,
Aug 25, 2016, 8:47:05 AM8/25/16
to Project Jupyter
Hi guys,

I am also very interested in this feature. It's been almost year now. Do you have any news about this feature ?

Best,

arn

unread,
Dec 28, 2016, 12:27:27 AM12/28/16
to Project Jupyter
This feature would be really helpful for those of us that run jupyter notebooks remotely. Any progress?

Matthias Bussonnier

unread,
Dec 28, 2016, 6:24:42 AM12/28/16
to jup...@googlegroups.com
> This feature would be really helpful for those of us that run jupyter
> notebooks remotely. Any progress?

There is some recent prototype of RealTime collaboration by Ian, thay
lay some ground work necessary for this to happen.
Though it's far down the line unless someone actually start to work on
this particular problem.
For now it is recommended to use Futures/Promises (depending on the
language) as a stopgap.
--
M

run2

unread,
Jul 21, 2017, 6:10:15 PM7/21/17
to Project Jupyter
Hey - does any one know any update about this. This is a pretty annoying thing and would be great to have fixed.

Alexey Goloviznin

unread,
Sep 13, 2018, 6:22:20 AM9/13/18
to Project Jupyter
Hi, any news therer?

Alexey Goloviznin

unread,
Sep 13, 2018, 7:32:56 AM9/13/18
to Project Jupyter
Hi, any news therer?

суббота, 11 июля 2015 г., 3:03:25 UTC+3 пользователь Brian Cheung написал:

Matthew Seal

unread,
Sep 13, 2018, 12:53:20 PM9/13/18
to jup...@googlegroups.com
One way I combat this for really long running notebooks is to run it with Papermill on the server in a screen session and come back to it in the morning. You can also use `--log-output` if you want the execution logs piped to a stream or file as well. Not perfect for all situations, but it solves the run a notebook and check back later problem.

- Matt

--
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 jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.

William Stein

unread,
Sep 13, 2018, 1:04:57 PM9/13/18
to jup...@googlegroups.com
Hi,

I implemented "capturing all output even with no browser" for the
CoCalc rewrite of Jupyter. If you try Jupyter notebooks at
https://cocalc.com, or using the cocalc-docker image
(https://github.com/sagemathinc/cocalc-docker), you can see what this
feels like. It works by storing all state on the backend server.

Jason Grout, Chris Colbert, and I talked recently at JupyterCon about
some about plans for JupyterLab (?) to implement functionality like
this, so I think something is in the pipeline. Maybe one of them
wants to comment.

One other workaround is just to send all output to a file by
explicitly using open and write and flush in Python (or whatever
kernel you are using).

-- William
> https://groups.google.com/d/msgid/jupyter/CAJF6vz5Xrp4y-GEabhuFD8XVNq4aNCH2Eoq%2BcwsSBxzLH36a0g%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
William (http://wstein.org)
Reply all
Reply to author
Forward
0 new messages