Feature idea: a temporary execution barrier #298
-
Hi guys, over the last few days, after having toyed with Pluto for a while, I spent a solid chunk of time using it for my actual real work. Aside from continuing to love reactivity and wondering how I've gone so long without it, I think I pinpointed one feature which I feel like could take my productivity while using Pluto to the next level, which I thought I'd propose (and apologies if this has already been discussed somewhere). For reference, I'm a physicist doing lots of free-form analysis work, probably pretty typical of your users in academia. Basically the thing I kept running into is I have a fairly "mature" notebook set up, and then I want to tweak something near the "beginning" of the DAG, but I might want to look at a few cells beyond that to check things are right, before letting the whole DAG run to the end, which may actually take minutes to tens of minutes in my case. What I usually ended up doing is to just make the change, look at the "quick check" cells as the whole thing evaluates, and then just interrupt and try again if "things weren't right". Unfortunatey interrupt is not always reliable or even possible if external libraries are called, and somehow the whole thing felt frantic. So my idea is basically just to add a way to place a barrier in the DAG either before or after a given cell (I ran into cases where both would be useful). I made a mock-up of what the UI might look like below. The button could live alongside the hoverable add cell above/below button, and once clicked would remain persistent (and can be clicked again to turn off). To visually indicate the temperary break in reactivity, the UI should dim all the subsequent cells in the DAG and hide their output. It would be something like this: In terms of what is saved in the notebook file, maybe the break in the DAG can be indicated by just commenting out code which is beyond the barrier, maybe with a I can imagine you might have some reservations about temporarily breaking reactivity, which I can definitely understand. I do think though that this isn't really getting rid of reactivity, instead its an optional "power" feature that kind of fits in the reactivity paradigm really well. If I recall too in your JuliaCon talk you mentioned work on a way to "check in" a bunch of changes at once. Maybe that's similar and you've already thought of this, it sounded like its trying to solve the same underlying problem, but if that's similar to "pausing" evaluation while editing several cells at once, I'll mention that the key thing here is that you get to look at the output of some cells after you've made a change. Anyway, just an idea I had which I hope you guys can consider. I'm more than happy to discuss more or to be a guinea pig should you decide to purse something like this. |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 22 replies
-
Hi @marius311, Thank you for the exciting suggestion! It sounds like you found this idea after some serious Pluto use, which makes it very valuable! I appreciate that you talked about the existing 'solutions' for this problem, and I can relate to your observations. Your suggestion gave me an idea: you would have a "hotbar" in the corner of the screen with "filters" that you can drag onto your cells - this would be one of them. Other might be capturing terminal output, step-by-step debugging, memory profiling, a browser notification when the cell is done, saving cell output to a file, ... Other packages could declare their macros as Pluto filters by giving them an icon a colour - or something. Even if it is just this single filter (execution barrier), I think that it would create a friendlier learning curve to hide it in a corner, instead of showing it next to every cell. You talked about having the barrier both before and after a cell. I see why both would be useful, but the feature would be easier to understand if there was only one option - I would say after the cell. What do you think? Another comment was that we don't really need to save it to a file, right? It seems more like something you want during your writing session. And blurring the cells is a very smart idea! I am worried that breaking the reactivity can turn your mental model into chaos, but this might solve it. A side note about stopping cells - of course it would be great if we can fix the problems that it has. The implementation is somewhat improvised, but I don't have any good notebooks to test it on. So I'd love to hear more about what you found, and maybe even an example of a notebook where Stop is broken? (#228) Thanks again, look forward to hear from you. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response! Some thoughts:
Yea I did worry too about the added complexity of before/after. The reason I wanted both is because I ran into both of these patterns:
In case 1 I wanted to put a barrier after quick check, and in case 2 I wanted to one before heavy computation. If you go with just a single barrier type, I think it should be the before kind though. If all you had was before, you could still do case 1 above, you just need to manually turn off each of the three heavy computation cells, which maybe isnt so bad. But if all you had was after, there would be no way to see the quick check cells without the heavy computation in 2. Fwiw, maybe that makes the UI easier to reason about too since its like you enable the barrier on a cell and that very cell gets blurred (along with its dependents). Maybe if there's just a single button you'd consider putting it in the "gutter" next to the hide cell button? Tbh I'm less a fan of click and drag which feels clunky, that gutter just feels like the perfect place to stick a few buttons and I kind of figured you guys had basically always been planning that.
I suppose its not critical, I agree its mostly during writing, I just thought it'd be nice to preserve the one-to-one mapping between a file and the current notebook state. |
Beta Was this translation helpful? Give feedback.
-
You're right that if there's only one, it should be the before type. This is similar to "commenting out" a block of code, except that you still see the output (half-faded), and dependent cells don't error. So it's a familiar concept, but 'reactified' - nice! |
Beta Was this translation helpful? Give feedback.
-
Hi I have the feeling that such a feature could provide what I like to have in #259, provided that such a barrier also becomes an element of the file format or kind of can be optionally set for the first cell directly after loading. Moving the barrier could automatically trigger execution of the cells freed from it. |
Beta Was this translation helpful? Give feedback.
-
For teaching and demos, what would be useful is maybe a button (like the present button, possibly using the present button), so that any cells that are past the current "slide" being presented are not yet evaluated. In my case, it is to have an interactive demo, showing off the advantages of the package being demoed as well as Julia - and incidentally, showing off the coolness of Pluto compared to Jupyter! |
Beta Was this translation helpful? Give feedback.
-
@ScottPJones this mechanism uses the order of cells to determine the runtime - this is something that Pluto fundamentally should not do. The original suggestion uses the topological ordering of cells, which is why i think it could work within the paradigm |
Beta Was this translation helpful? Give feedback.
-
@marius311 I love this idea, clearly you know the pain point of users of "our kind". One comment: because of the reactivity model, we indeed have to do this "before" cell. Say we have a variable In summary how this should work:
|
Beta Was this translation helpful? Give feedback.
-
If this is implemented it would be great if Pluto would automatically flag certain cells as long-running (after they have first run and been observed as such) and ask the user the next time they are about to be run if they want to defer execution (with a "no, and never ask me again" option of course). Bonus: Pluto could offer to wrap the cell with some kind of memoization. |
Beta Was this translation helpful? Give feedback.
-
I think the simplest for students is to base reactivity on wherever one runs a cell - those at or earlier would be reactive and those after would not be affected (I don't see any logical/topological inconsistencies in this and it is simple). The property of reactivity would not be permanent - just dependent on where one chose to execute. For full reactivity, one could merely always execute the last cell. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone! So I'm using Suppose I want to create a book on machine learning, (imagine trying to create an interactive version of this book). A collection of cells can be considered a section or subsection. A single notebook can be considered a chapter. The overarching goal is to allow the reader to easily navigate across chapters, interact with plots that have live demos of how certain algorithms work, and allow them add their own custom code to the algorithms to see how their modification/extension changes the results. The way I see this working:
I like the idea of blurring out sections and when the user clicks on a section it begins to load. As soon as an observable in one section is changed, rather than immediately passing the updated value to sections that listen to this observable, those sections are simply blurred out, signalling to user that changes they made require re-computation. |
Beta Was this translation helpful? Give feedback.
-
I think being able to mark individual (typically compute heavy) cells as "don't auto-update" would open up Pluto to a whole new range of applications. While the user is playing around with some cells that (e.g.) define the input of a calculation, they typically will not want their (maybe chain of) expensive "main calculation" cells to be re-run all the time. Another aspect, beyond usability of a notebook with compute-heavy cells, is resource usage: In contexts where cluster or cloud job submissions are involved, running certain cells might actually consume limited computation budgets (or money, in the case of cloud). Even if not, it might load a system heavily, affecting other users. So allowing for optional control of the update-mechanism would also be resource-friendly. I like the idea of "blurring" or "greying out" outdated output of such cells (and the output of cells than depend on them). I think it should be done in a way that keeps the output readable (people may still want to see an outdated plot or so) but that is clear enough to give the intuition that it's not up to date. |
Beta Was this translation helpful? Give feedback.
-
I think this also relates to #959 (Use Pluto to control physical systems). I definitely have my eye on Pluto as a possible graphical interface to control things and run/montitor measurements in our lab (which runs mostly on Julia software by now). But I would definitely want a barrier before cells that contain code like "ramp up the high voltage now", "start the vacuum pump", etc. ... :-) |
Beta Was this translation helpful? Give feedback.
-
Summarizing the discussion above / my suggestions for implementation: Use Cases:
Suggestion:
Technical implementation:
Happy to take a first look at the backend! |
Beta Was this translation helpful? Give feedback.
-
Hi, just would like to remind about #421 in this context. We would need to store more cell metadata to implement what has been proposed. Would love to try a PR but not before April... |
Beta Was this translation helpful? Give feedback.
-
implemented in #985 |
Beta Was this translation helpful? Give feedback.
implemented in #985