New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get output after closing and reopening the browser tab with notebook #12422
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Elyra allows for the running of a notebook as a batch job, which may address the use case that you're describing: I don't see any other issues in JupyterLab to allow the server to both execute the code and modify the notebook, so that you can (for example) close the tab or open your notebook on a separate instance and see the results of long-running scripts. For this reason, I've accepted this issue. |
As a workaround, you can run a computation and save the output to a variable. Then, if you close your browser tab and execution continues, you can come back, and the output should be accessible as a variable. |
Hi @jweill-aws , could you tell me how to save the output to a variable? |
You can save the output by assigning it to a variable using standard Python syntax. If you still want to display it, you can refer to the variable on the next line. For example, change long_running_function(variables) to: myoutput = long_running_function(variables)
myoutput |
Also @chenmicheal, take into consideration magic command %%capture which (quote from documentation) "runs the cell, capturing stdout, stderr, and IPython’s rich display() calls." With this magic command you can save all output of a cell into the variable in a native way for Jupyter notebook Source: Usage examples: |
thank you both very much! |
This is an often requested feature and discussed at many places. I want to add some links here, maybe it helps to find stuff. Workarounds and explanation:
Other Github issues:
Zeppelin and Datalore have such a feature implemented. A comment suggests that this issue might be related to RTC, but JupyterLab 3.4.4 does not support reconnecting after all browser tabs have been closed even with RTC enabled (just tested it). |
Closing as a duplicate of #2833. Of note there is now a PR implementing this: #15448
Just FYI, Jupyter is open-source, community-driven everyone is welcome to contribute one way or the other. If you would would like to discuss a particular topic, weekly jupyterlab meetings may be suitable to get an informal answer but it is unlikely any one contributor would speak for the entire community on such high-level feature requests. |
Problem
I have a following situation. There is a multiple hour computation ran by Jupyter notebook. After the computation started I would like to close the tab. Then open the tab again (maybe on different device if the computation was run in the cloud) and check the output. But after I reopen the tab there is no output since the mappings between "Execution request" and the "Execution reply" are gone. There is a stackoverflow thread describing the problem in more precise way so I don't have to duplicate the concrete issue description.
Proposed Solution
What I would expect to see is that after starting of computation I would not have to keep my notebook opened in browser to keep the mappings between "Execution request" and the "Execution reply" alive. Instead I could close the tab and after multiple hours just return to the notebook for the output.
Could the notebook model be moved from client side to the server side? This way the mapping between "Execution request" and the "Execution reply" would not be lost and there would be no problem if one closed the tab, then reopened it and wanted to check the output.
Additional context
If I understand correctly this issue is known by the Jupyter team and I would like to get an update in case it has been forgotten since it would resolve my ongoing problem. Also I would appreciate some kind of workaround suggestion. I am printing everything twice into the standard output and into the log file (where I can tail the appending output real-time). But this is not a very elegant solution.
The text was updated successfully, but these errors were encountered: