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
Script to spawn a browser / start notebook. #693
Comments
Modifies |
comment:1
Attachment: trac_693-spawn-browser-start-nb.patch.gz This patch should do the trick. Apply to scripts repository. |
Author: Tim Dumol |
Attachment: trac_693-spawn-browser-start-nb.2.patch.gz Checks if the notebook server is running too, instead of just checking if the PID exists. |
comment:2
I am not sure which method is preferrable, since checking if the notebook server is running does not work if the user has no permission to read |
Attachment: trac_693-spawn-browser-start-nb.3.patch.gz Fixes bug with arguments. |
Attachment: trac_693-spawn-browser-start-nb.4.patch.gz Same thing, without actually checking if the Twistd process is running |
comment:3
I don't get it. If I do
then when I execute the second line it might just pop up a notebook server pointed at port 8001. Actually, given the line:
I think it would give an error, since port= is specified twice. This is because you introduced a new environment variable SAGENB_PORT which isn't documented. I don't know why it is there. I think you should get the port from the port= option on the command line. I think you should get port= from the command line and get rid of the SAGENB_PORT environment variable. Also, you use:
but actually, you need to use the file Finally, I think this code should be in the notebook(...) command in Sage itself. It's wrong putting it here in this shell script, because it only half way fixes the problem. E.g., imagine a user that types the following and leaves that in a console:
Then in another console, they type
Instead of giving an error, it should just given them the notebook. Also, there is a notebook(fork=True) option, so one can do
William |
Attachment: trac_693-spawn-nb.patch.gz Changes run_notebook.py to launch a browser to the notebook page should an instance in the directory exist. Apply to sagenb repo. Apply this patch only. |
comment:4
All your points make sense. I have implemented the changes in |
comment:5
On OS X this doesn't work at all. Depending on what I do either I get two notebook servers running simultaneously on the same directory (bad), or I get "Another twistd server is running, PID 40940". On OS X there is no /proc filesystem. However, when I run this code from this patch:
I don't see "2" printed, i.e., no exception is raised. That's clear if you read the code -- you don't raise an exception. |
Attachment: trac_693-spawn-nb.2.patch.gz Uses signals only to check if the process exists (as Twisted does) |
comment:6
I have removed the /proc check, since it's what Twisted does anyways. |
comment:7
I guess we need to update the patch to take advantage of #2779? |
Open browser if server running and |
comment:8
Attachment: trac_693-spawn_notebook.3.patch.gz V3:
|
Reviewer: Tim Dumol |
Changed author from Tim Dumol to Tim Dumol, Mitesh Patel |
Changed reviewer from Tim Dumol to none |
comment:11
|
comment:13
Apply trac_693-spawn_notebook.3.patch |
comment:14
I'd like to test #8473, which depends on this, but I'm reluctant to do so until someone who knows something about the notebook takes a look at this. Bug days folks? |
comment:15
Open browser if server running and open_viewer=True. pep8 clean-ups. Rebased for queue in comment. Replaces previous. |
comment:16
Replying to amog2011:
This is a spam comment. Can someone please remove this 'user'? I don't know who has permissions for this. |
comment:18
Replying to @kcrisman:
amog2011 is already banned. |
comment:19
I have been using this (with #8473) for some time without problems. I have also reviewed the code and it looks okay given my limited understanding of the notebook. |
comment:20
Replying to @gvol:
Thanks. It applies just as cleanly (one hunk misses with fuzz) to current SageNB as in the comment above. This could be added in a new spkg with the Jmol updates. |
Reviewer: Ivan Andrus |
This comment has been minimized.
This comment has been minimized.
Merged: sage-4.7.alpha3 |
I've had an icon sitting on my desktop for about a week now. When I click on it, and it starts a notebook in a background terminal and spawns a browser. I'd like to be able to click it a second time, and open another browser window, instead of the current behavior of attempting to start another notebook.
Should work something like this:
Apply attachment: trac_693-spawn_notebook.3.patch
CC: @williamstein @qed777 @wjp @sagetrac-acleone @mwhansen @jdemeyer @sagetrac-mvngu
Component: notebook
Author: Tim Dumol, Mitesh Patel
Reviewer: Ivan Andrus
Merged: sage-4.7.alpha3
Issue created by migration from https://trac.sagemath.org/ticket/693
The text was updated successfully, but these errors were encountered: