Skip to content
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

Disable Cell button #985

Merged
merged 151 commits into from
May 25, 2021
Merged

Disable Cell button #985

merged 151 commits into from
May 25, 2021

Conversation

lungben
Copy link
Contributor

@lungben lungben commented Mar 9, 2021

My first works on #298

Still very WIP!

Use Cases:

  • give a method to prevent auto-update of cells which take too long to compute to keep the notebook reactive and/or save computational resources.
  • step-by-step computations for educational purposes

Suggestion:

  • Allow the users to add execution barriers to Pluto cells from inside Pluto.
  • These barriers block execution of the cell they are added to (i.e. located before the cell) if active.
  • The barriers should be stored in the notebook.jl file, e.g. as comments.
  • If the notebook.jl file is executed in Julia (without Pluto), the whole file should run, ignoring execution barriers (there would be no way to turn them off without Pluto anyhow).
  • If an execution barrier is active, the cell and all cells depending on this cell should be marked gray in Pluto, so that it is obvious that they are not executed.
  • When deactivating an execution barrier, the corresponding cell and all dependent cells are executed immediately and not grayed out anymore.

Technical implementation:

  • Execution barrier information (is there a barrier? is it active?) could be added to the Cell structs in the backend.
  • Save this information in notebook.jl files and load it from there
  • Based on which cells are deactivated and the cell dependency information, the backend decides which cells to evaluate in case of changes.
  • Pass the barrier information to the frontend
  • In the frontend, the information whether a cell is grayed out is determined based on the execution barrier information in the Cells and the cell dependency information from Visualize cell dependencies (Backend) #891
  • Frontend functionality for activating and deactivating of execution barriers plus visualization of execution barrirers required.
  • Pass changes in barrier information back to the backend
  • Run cell if its execution barrier is deactivated and it does not depend on any activated barrier
  • Tests?
  • Merge current master (currently not working for me out-of-the-box)

Note: this PR is based on #891, the first commit specific to this PR is 5975d25.

Try it out!

julia> ]
pkg> activate --temp
pkg> add https://github.com/lungben/Pluto.jl#execution_barrier
julia> import Pluto; Pluto.run()

@fonsp
Copy link
Owner

fonsp commented May 25, 2021

Looks good! Thanks again for your patience and for working together on getting this done!

Before we merge, I would like to:

  • Tweak the CSS and JS
  • Fix layout for touch input devices
  • Try to break it :)
  • Run button is broken/confusing for disabled cells
  • On disabled cells, Shift+Enter should save code changes without enabling them
  • set_waiting_to_run is buggy
  • Stack overflow when clicking on a RunArea when a circular referencing cell is disabled
  • Circular referencing cells do not show greyed out
  • Clean up julia code

I will work on it right now!

@fonsp
Copy link
Owner

fonsp commented May 25, 2021

I reused the existing topological_order function to find the indirectly disabled cells: 47934ce (#985) This makes the PR much smaller :)

@fonsp fonsp merged commit 35c754d into fonsp:main May 25, 2021
@lungben
Copy link
Contributor Author

lungben commented May 25, 2021

Cool, thanks!

@fonsp
Copy link
Owner

fonsp commented May 27, 2021

@oschulz
Copy link

oschulz commented May 27, 2021

Yay!!

@rajithv
Copy link

rajithv commented Jul 1, 2021

Does the temporary execution barrier work in 0.14.8? I'm trying to find how to use this feature. Thanks!

@lungben
Copy link
Contributor Author

lungben commented Jul 1, 2021

Yes. You can activate it by pressing the (...) button at the right side of the cell and then "Disable Cell".

@fonsp fonsp changed the title Temporary Execution barrier Disable Cell button Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Concerning the HTML editor reactivity The Pluto programming paradigm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants