Ticket #5177 (needs_work defect)

Opened 19 months ago

Last modified 5 months ago

Notebook keeps directories for deleted cells

Reported by: kcrisman Owned by: boothby
Priority: major Milestone: sage-4.5.3
Component: notebook Keywords:
Cc: ddrake Author(s): Tim Dumol, Mitesh Patel
Report Upstream: N/A Reviewer(s):
Merged in: Work issues: Requires speed optimization

Description

If you delete a cell, it doesn't delete the directory for the cell, at least not very soon (it does seem that they eventually get deleted). Should it maybe when you log off the worksheet? Or maybe immediately. This is particularly bad when there are large computations or graphics involved, and may contribute to making .sws files rather large even if there are few cells.

Attachments

trac_5177-delete-cell-dirs.patch Download (0.8 KB) - added by timdumol 8 months ago.
Uses twisted.internet.threads.deferToThread to delete cell directory on cell delete. Should apply cleanly on sagenb-0.5.0.
trac_5177-delete-cell-dirs.2.patch Download (0.6 KB) - added by timdumol 8 months ago.
Trivial rebase on new patch queue. (Deletion of one empty line)
trac_5177-delete-cell-dirs.3.patch Download (1.0 KB) - added by mpatel 7 months ago.
Also delete files when deleting all output. Synchronous only. Replaces previous.
trac_5177-delete-cell-dirs.4.patch Download (5.7 KB) - added by mpatel 6 months ago.
Add doctects to V3. Apply only this patch. sagenb repo.

Change History

Changed 19 months ago by mabshoff

  • milestone changed from sage-3.4 to sage-3.4.1

3.4 is for ReST tickets only.

Cheers,

Michael

Changed 8 months ago by timdumol

Uses twisted.internet.threads.deferToThread to delete cell directory on cell delete. Should apply cleanly on sagenb-0.5.0.

Changed 8 months ago by timdumol

  • status changed from new to needs_review
  • upstream set to N/A
  • author set to Tim Dumol

This hopefully won't cause any performance problems. Anyone mind giving their opinion on this?

Changed 8 months ago by timdumol

Trivial rebase on new patch queue. (Deletion of one empty line)

Changed 8 months ago by timdumol

This is then new patch queue:

trac_7650-sagenb_doctesting_v6.patch
trac_7650-reviewer.patch
trac_7648-missing_indent.patch
trac_7663-rstrip_prompt.patch
trac_7847-empty-trash-no-referer.patch
trac_7786-template-jinja-idiomatic.patch
trac_7863-declare_vars_aux_js_v2.patch
trac_7874-typeset_interact_labels.patch
trac_7858-key_binding_vars_v2.patch
trac_7666-alphanumeric_cell_ids_B5.patch
trac_7666-reviewer.patch
trac_7835-preparsing-unicode_v2.patch
trac_7249_jinja2_v5.patch
trac_2779-sagenb-error-message.patch
2779_2_banner.patch
trac_3154-spurious-u0027-output.patch
trac_7969-escaped-backslash.patch
trac_7937-sass_manifest.patch
trac_4217-html-system-formatting.patch
trac_3083-print-documentation.patch
trac_7962-link-worksheets-zip-file.patch
trac_5177-delete-cell-dirs.patch

Sorry for the immense queue.

Changed 8 months ago by kcrisman

I can't review this, but thank you so much for doing it - it really annoyed me and it's the sort of background thing that in the long run will make Sage so much better even if no one ever sees it.

Changed 8 months ago by mpatel

  • cc schilly added
  • status changed from needs_review to needs_info

If I evaluate

print 'Hello!'
plot(sin(x))

then "Delete All Output," "Save & quit" and reopen the worksheet, the plot (not the text) reappears.

We could also delete the cells' files in Worksheet.delete_all_output. But we may wish to do this synchronously; otherwise, a long-running or simply delayed (e.g., on a busy server) thread might remove newly-written files.

(For deleting just one cell, there might be a similar but less likely race condition. For example, if after deleting a cell (with ID <id>) in the browser, a user pastes and saves {{{id=<id>|\n<updated code>///\n\n}}} in the "Edit" window, and re-evaluates the cell, a delayed Deferred could delete new files.)

What do most users expect/prefer?

I'm adding schilly to the Cc: list, since he's almost certainly better qualified than I on this (and many other) topics.

Changed 7 months ago by mpatel

Also delete files when deleting all output. Synchronous only. Replaces previous.

Changed 7 months ago by mpatel

  • cc was added
  • status changed from needs_info to needs_review

V3 deletes the output synchronously (on the server), whether it's for one cell or for the whole worksheet.

I think this is much safer, since it avoids race conditions. Although deferred deletions could help performance, we already copy a cell's output synchronously. But with the appropriate locks or other synchronization constructs (e.g., "marking" cells for deletion), we could offload some tasks to other threads or to worksheet processes.

Changed 6 months ago by mpatel

  • cc ddrake added; schilly, was removed
  • status changed from needs_review to needs_work

We should be able to doctest both "hunks" on V3.

Changed 6 months ago by mpatel

Add doctects to V3. Apply only this patch. sagenb repo.

Changed 6 months ago by mpatel

  • status changed from needs_work to needs_review
  • author changed from Tim Dumol to Tim Dumol, Mitesh Patel

Changed 5 months ago by timdumol

  • status changed from needs_review to needs_work
  • work_issues set to Requires speed optimization

Since a major problem with the notebook right now is its performance, and this may slow it down even further, I'm putting this to "Needs work; requires optimization".

Note: See TracTickets for help on using tickets.