-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
is it possible to make a jupyter notebook run even if the page is closed? #2446
Comments
Anything already running in the notebook will keep running, and the kernel it started for that will stay running - so it won't lose your variables. However, any output produced while the notebook isn't open in a browser tab is lost; there isn't an easy way to change this until we have the notebook server able to track the document state, which has been on the plan for ages. |
Dupe of #1647? |
@takluyver -- I have verified that the notebook keeps running in the background with: from time import sleep
file = open("jupyter_tab_close_test", "w")
file.close()
i = 0
while True:
print("{}\n".format(i))
i +=1
with open("jupyter_tab_close_test", "a") as f:
f.write("{}\n".format(i))
sleep(1) When I I had an idea for how to at least keep output to stdout, but it does not work, and I don't understand why.
I would expect to see the output pick up where it left off being written to the console. I don't see that. |
@takluyver Is the problem handled? If not, maybe we can redirect the output into a file so that it is available in a different console. But how could it be easy to achieve (write as little code as possible)? |
There is a kind of interim fix in place: when the browser disconnects, the server should now buffer output messages until the browser reconnects, and then send them through. |
Great news! |
How does that work in practice. How do I disconnect my browser from the session other than closing the tab? |
Closing the tab is the only explicit way to do it, as far as I'm aware. It may also happen if network issues mean the server can't send output to your browser. In either case, some outputs may be lost if they're sent before it detects that the websocket is disconnected. |
@takluyver alright thanks :). I'll give it a try. |
Maybe. That person seems to be using Google Colab, though, so it might be a bit different. |
Simple fix could be instead of just using the built-in |
just log output to a file so you can see it later - e.g. something like """
|
This is being solved in JupyterLab and will be solved in the future Notebook v7 release. For more information about this new release, checkout the Notebook v7 Enhancement Proposal. |
I am running multiple notebooks at the same time, often in different browsers, sometimes on different remote clients. till now, when I close the tab corresponding to a running notebook, it warns that the corresponding run will be stopped.
My question: How do I make a jupyter notebook resume it's run even if the page is closed ?
From what I understand, the client-server architecture could make that possible, but that there may be issues with multiple concurrent runs...
PS: I also asked the question on SO and will make sure to make this issue updated if I get solutions.
The text was updated successfully, but these errors were encountered: