[IPython-User] autosave in notebook

Brian Granger ellisonbg@gmail....
Sun Jan 15 16:23:11 CST 2012

On Sun, Jan 15, 2012 at 12:49 PM, MinRK <benjaminrk@gmail.com> wrote:
> 2012/1/15 Brian Granger <ellisonbg@gmail.com>:
>> 2012/1/15 Zoltán Vörös <zvoros@gmail.com>:
>>> Hi Brian,
>>> On one hand, I see your point, on the other hand, I don't. I agree that
>>> unintentionally overwriting existing and valid data with new, but faulty one
>>> is a problem. However, just as big a problem is when the browser fails, and
>>> you lose the data altogether.
>> Yes, which is why we are thinking about these things.  But
>> realistically, I have been using/developing the notebook for many
>> months (probably more than most), and I can't think of a single time
>> that my browser crashed leading to a loss of data.  That is not to say
>> it doesn't happen, but that the situation is not so severe that can't
>> take a little time to figure our a permanent solution.
> Intermittent network connections and traveling laptops (connected to
> non-local notebook) are probably more likely causes than crashing
> browsers.

Notebook saves should work fine across network failures.  The save is
done in an AJAX call and the browser should reconnect if there are any
network failures.  IOW, it shouldn't require a data-loss-inducing page
reload after each network failure.

>>> As a temporary solution, couldn't there be a backup file to which one could
>>> autosave every 5 minutes, or whatever, and you would only write to the
>>> master file when pressing the "Save" button? That would eliminate the issue
>>> you raised, but would still be more than nothing.
>> I guess I would rather wait a bit longer and figure out how we want
>> the notebook to integrate with version control systems.  In our view
>> this part of the notebook is extremely important and is worth getting
>> right.  For now I am -1 on implementing a temporary solution,
>> especially one which pollutes the local directory.  I would like to
>> hear from others though (@fperez, @minrk, @takluyver?).
> Fernando proposed *exactly* this, backup-save a while back, and I
> think it's a good idea.  A document-based webapp that doesn't autosave
> is simply not a good webapp, because the assumption network
> connections are sustained and reliable is a 'recipe for data loss', as
> you put it.  This is not a significant issue for localhost notebooks,
> but it would be for remote ones.  My principal objection at the time
> to an implementation detail was adding clutter to the working dir,
> which I think we should work very hard to avoid doing.

If saves can be performed across network failures, I would like to
take the time to think carefully about how we want to solve the
version control/autosave issues.  It may be that we end up with some
sort of autosave that is done in the manner proposed here, but we may
find a paradigm that works better.  These are exactly the types of
things that we could discuss at PyCon.

I also agree that we really want to avoid cluttering the working dir
of the notebook.

The other issue here is that we need to start to think about how a
full multiuser notebook would affect these things.  Because the
existing notebook uses different notebook_id's each time the server is
started, some kinds of things are difficult.  We may need to start
persisting information to a db so that we can track information across
server runs.  This would enable us to save the autosaved versions in
the IPYTHONDIR somewhere and refer to them across server runs.  Moving
in the direction of a multiuser notebook would force us to think about
these things.

>>> If that is an acceptable solution (writing to notebook.ipynb.backup every 5
>>> minutes), I still don't know how one would implement this. I could set up a
>>> timer, and call save_notebook(), but how can I retrieve the currently active
>>> tab in the browser? If I write the timer function into the notebook
>>> template, will the same timer apply to all open notebooks, or only the
>>> active one? Besides, I am not certain at all as to where exactly the timer
>>> should be.
>> Implementing this would require changes on both of server and browser
>> side of things.  We would need a new URL/handler to handle the
>> autosave requests along with the logic in the notebookmanager.  On the
>> browser side, the timer should be in savewidget.js and it will affect
>> only a single notebook at a time.
>> Cheers,
>> Brian
>>> Any comments on this, or you think that this approach is just an ugly hack,
>>> and it is really not worthwhile?
>>> Cheers,
>>> Zoltán
>>> On 01/15/2012 08:34 PM, Brian Granger wrote:
>>>> Autosave without version control built-in is a recipe for data loss
>>>> disaster.  To prevent unwanted losses from autosave, you need the
>>>> ability to rewind and recover lost work.  This is something we are
>>>> thinking about, but is still a ways off.
>>>> Cheers,
>>>> Brian
>>>> 2012/1/15 Zoltán Vörös<zvoros@gmail.com>:
>>>>> Hi All,
>>>>> I am sorry for spamming the mailing list, but I happen to use the
>>>>> notebook quite a lot at the moment, and during this I find myself facing
>>>>> newer and newer questions. I try to find the answer, before posting the
>>>>> problem here:)
>>>>> Is there a way to set autosave on on the html notebook? I don't mean the
>>>>> content of the cells, because that could be pulled out of the history
>>>>> (at least, the inputs), but the notebook as a whole. I see that for
>>>>> large notebooks with many images this might create a bottleneck, but if
>>>>> the user was able to switch this off/on, that would be great.
>>>>> I believe, one would only have to set up a timer in javascript, and call
>>>>> the function that is invoked on Cntr-M-S. I could look into this, but I
>>>>> don't know, whether there is already an effort under way.
>>>>> Cheers,
>>>>> Zoltán
>>>>> _______________________________________________
>>>>> IPython-User mailing list
>>>>> IPython-User@scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>> --
>> Brian E. Granger
>> Cal Poly State University, San Luis Obispo
>> bgranger@calpoly.edu and ellisonbg@gmail.com
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

More information about the IPython-User mailing list