These are chat archives for ipython/ipython

24th
Jan 2015
Jessica B. Hamrick
@jhamrick
Jan 24 2015 02:45
What’s the best way to debug whether a kernel is even handling an interrupt?
I’m trying to modify the ExecutePreprocessor so that continues executing even if a cell times out
Which then requires interrupting the kernel
Except nothing seems to happen, and I’m at a loss for where to look to figure out why
Min RK
@minrk
Jan 24 2015 03:06
I'm not sure. Being me, I would add log statements in the kernel, and ensure kernel's stderr is not being captured.
Jessica B. Hamrick
@jhamrick
Jan 24 2015 03:07
Ok
If it is properly handing the interrupt, it shoudl just go back to being idle, correct?
Does it send an execute reply if it is interrupted?
Min RK
@minrk
Jan 24 2015 06:41
sorry, was afk. Yes, there should be a reply.
Michael Goerz
@goerz
Jan 24 2015 11:57
Something that has confused me for a while: it looks like I can open the same notebook (accidentally) in two different browser tabs, which means that if I edit both of them, they overwrite each other on disk.
I would expect that opening a notebook would lock it. So that opening it again in the web interface (either with the same or with a different kernel), would either refuse, or ask me whether I want to create a copy of the notebook and open that. Something like vim does when trying to edit the same file twice.
Is there an option to enable such locking that I overlooked? Is there interest in implementing this?
Should be as simple as writing a flag to the json that the notebook is currently open.
Andreas Klostermann
@akloster
Jan 24 2015 12:27
I'm not aware of any locking discussion, and as long as the multi-user/multi-tenant features are in flux I would suspect such features are a long time away. My recommendation is to avoid opening notebooks in multiple windows.
Michael Goerz
@goerz
Jan 24 2015 12:28
multiuser would be an entirely other way to solve the same problem, of course, but far less trivial
Andreas Klostermann
@akloster
Jan 24 2015 12:30
I don't see a point in opening notebooks in different windows except by accident.
Michael Goerz
@goerz
Jan 24 2015 12:32
No, exactly! I want to make sure that I don’t. It just happens to on a regular basis, and I’ve accidentally overwritten code that. Maybe I just have to work on keeping my desktop more organized.
I just tend to forget that I have a brower window open on another workspace that has the same notebook loaded.
So I was hoping to get a warning “This notebook is already open” if I try to open it again
Andreas Klostermann
@akloster
Jan 24 2015 12:36
are you aware of the checkpointing feature?
Michael Goerz
@goerz
Jan 24 2015 12:37
Not really, except that I’m vaguely aware that iPython does some kind of automatic saving
So suppose I have accidentally opened the same notebook in two tabs and edit them both
At least if I hit ’S’ in both of them to save, they would overwrite each other, right?
Andreas Klostermann
@akloster
Jan 24 2015 12:38
You can hit ctrl-s to create a checkpoint and then later revert to it
Michael Goerz
@goerz
Jan 24 2015 12:38
right, yes
Andreas Klostermann
@akloster
Jan 24 2015 12:38
that way you can restore changes you overwrite
I think the checkpoints don't get overwritten
Michael Goerz
@goerz
Jan 24 2015 12:39
That makes sense.. I just hit s way too frequently (a habit of not trusting any kind of automatic saving)
There’s always only one checkpoint, though, right?
Andreas Klostermann
@akloster
Jan 24 2015 12:39
if this happens to you a lot, and you are doing serious work in IPython, you should also think about general version management in your projects
Michael Goerz
@goerz
Jan 24 2015 12:40
I do have version management, yes
Andreas Klostermann
@akloster
Jan 24 2015 12:40
hm yes
I thought there were multiple checkpoints
Michael Goerz
@goerz
Jan 24 2015 12:40
If the entire history of checkpoints stayed available, that would solve the problem too, to some extent
(although I’d still be liked to slapped for doing something stupid like opening the same notebook twice)
Andreas Klostermann
@akloster
Jan 24 2015 12:42
yes, but that's really hard to do
Michael Goerz
@goerz
Jan 24 2015 12:42
Yeah, I would say so
Andreas Klostermann
@akloster
Jan 24 2015 12:42
you could try to open a github issue (or see if one is available)
Michael Goerz
@goerz
Jan 24 2015 12:44
Ok.. I might even look into it myself. What I’m thinking of is very basic: just set a flag in the notebook that it’s open, and as a minimum, display a warning when opening a notebook that is flagged as being open already (with an option to ignore)
It could be a plugin, too.. using the notebook metadata
Andreas Klostermann
@akloster
Jan 24 2015 12:45
the tough part is figuring out where that flag should be going
notebook metadata has the problem of being inside the file you would like to avoid overwriting
Michael Goerz
@goerz
Jan 24 2015 12:47
Yeah, the file would have to be saved,with the modified flag immediately after being opened.
I wouldn’t mind that
If it’s not stored in the file, there would have to be a list of open files in the .ipython directory
Sort of like vim does the detection of editing the same file twice
Personally, I think I’d go with storing it in the notebook, but I can see that might cause problems for some workflows.
Well, maybe a plugin providing the kind of locking I’m thinking of would work.. might make that a weekend project one of these days.
Michael Goerz
@goerz
Jan 24 2015 12:53
Basically: browser opens file from disk, checks flag. If flag is 0, just load normally, but immediately write notebook with flag set to 1. If flag is 1, load it normally but show a big warning that the file is already open (and obviously don’t write it back to disk).